AS2 - Make Object Faster - actionscript-2

I wanted to make an object faster in AS2. Currently this is my code:
.frameRate doesn't help make the object go faster. Is there any other way?

I think the problem is in [shift].

Related

Is it possible for me to set my boolean variable to true and false at the same time?

The program I'm writing, or at least what I have written of it so far, really relies on this somehow working.
If anyone could come up with a direct solution that would be really appreciated, but if it's impossible (or at least really improbable) then I guess a workaround would work, but it would be extremely inconvenient to my work.
That sort of goes against the definition of a boolean.
You could create your own custom structure that can be any of 3 states instead.

coredata deleteAllObjects is there a faster way

Before I go to write my data to my coredata I call
[self deleteAllObjects:#"MyEntity"];
But this seems to iterate through every single object and delete them which seems abit slow. I was wondering if there is a better / quicker way of doing this.
I have checked out the coredata notes on the developer site.. but thats the only function I can find for deleting entries out of your entity.
Since iterating is expensive, there are quicker ways. You can check these answers that have been discussed on SO before here, here and here.

List all context keys in a velocity template

Is there a way to list all keys in a velocity context from the template that is currently being expanded? I've done this in the past by including a reference to the context in the context. I guess this method is okay, but I'm wondering if there's a better way to do it.
That's the traditional way, and there is nothing wrong with it. If you are using VelocityTools, you can use the ContextTool to accomplish that and a bit more.

Handling lots of objects

First, I am an objective-c newbie. Just thought I would get that out of the way ;)
I am trying to handle objects but I'm a bit confused about the best way to go around doing so. Let me put this into a bit of context:
I have a preference area where a user can add a new Foo to the app. Once the input fields are validated it should spawn a new object of type Foo (according to my Foo class). The user could have anywhere from 1 to 100 of these in the app. What is the best way of keeping track of all of these? How can I create them in the code and keep track of them?
I bet that made no sense, but I have tried to explain it the best I can. Please feel free to ask for more details.
Thanks in advance for any help
Oh, I thought you said lots. :-) I was already planning an explanation on the flyweight pattern when I read 'up to 100'. You can just put these in an array.
It depends somewhat on what you want to do with them. To just keep them in RAM, you can store pointers to those objects in an NSArray (or NSMutableArray), or if you need to be able to find them with a key use an NSDictionary (or NSMutableDictionary). To save them so that they persist even after your app exits so you can load them again next time you can them write them to a file (plist, sqllite, coredata, ...).

Trying to grab integer from pre-defined p-list? ObjC/Cocoa

I'm working on an Objective-C/Cocoa roguelike, because I've always found that working on a game is the best way to learn about a language. I've gotten quite far with my game, but I'm having a problem.
Each level.plist is defined with a few things, like so:
<key>Save Location</key>
<integer>0</integer>
It's grabbed like so, I'd also like to say that this code is all working fine:
NSObject* level = [mapDictionary_ objectForKey: kLevelNumberKey];
However, in my NSLog-exploring, I've found that instead of grabbing me an integer, or even a useful number, this grabs me an object of some sort, which returns the correct value when NSLogged. How would I go about making this value into an integer so that I can use it like I'd want to be? Note that I've only used NSObject* because nothing else worked right. If I used =(int) instead I would get the pointer value or whatever (1108608 for example).
I'm sure it's a simple solution, and I thank you in advance. If you would not mind explaining exactly what is happening, that would be great. My grasp of the concepts is fine, better than most newcomers, but I'm always interested in exactly what is happening. What use would learning to program be if I didn't know what was going on! Please be more than willing to advise me of other situations like this to watch out/be ready for as well. Any advice, really is appreciated, and will be going to somebody who intends to code for a very long time. I put off learning this much too long, my only regret is not starting earlier.
If, for whatever reason, you are interested in trying out my game so far: Link I'm currently in the process of implementing state-saving so that levels remain as you left them. It's obviously OS X only. I'm pretty proud of it so far, but I have a long ways left. The controls are listed in the app.
The value is an NSNumber object. You can get it as an int using the -intValue method
More details about Property List types