I am making a math practice game in which numbers move around on the screen in an animation loop. Each number will appear on the screen from one side and travel across the screen and off the screen on the other side. Here's what I'm wondering - would it be better in terms of CPU performance to use a graphic of the number, or just put the number in a field and move the field?
It will be way easier to code if I can just move text fields around, but I really want this game to perform on an iPad 1, so I need to be as efficient with my code as I can. I'm just wondering if anyone knows if it's easier for LiveCode to move an image than a field with text. I'm hoping it doesn't matter. Anyone know?
Animation Question
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 211
- Joined: Sun Oct 24, 2010 12:13 am
Re: Animation Question
Either should be fine. As you say, moving a label field around would work, so would the image (or a button with a image icon). Not sure about memory usage, obviously if the images being used are large, there would be more memory usage with the image method. If you DO go with the image method I'd recommend using buttons and icons so you only have to have 1 actual copy of your image that you could use with multiple buttons. (again, a memory saver)
-
- Livecode Opensource Backer
- Posts: 211
- Joined: Sun Oct 24, 2010 12:13 am
Re: Animation Question
OK, so I've run some tests on the iPad 1, and you're right, sturgis - both work just fine. What I am actually doing is making a shooting gallery type educational game with three rows of ducks, moving in alternate directions, and three different speeds, and the ducks are three different sizes. If that makes sense. And I have a number on each duck. I could render 99 different versions of each duck, but it turns out I don't have to - I put each duck graphic with a field and grouped them, with both set to Dynamic and with the group set to Dynamic. When I tried 50 frames per second on the iPad 1, it looked a little choppy. I changed it to 30 fps and it looks good!
I'm using an image object and then loading the image with the appropriate duck, similar to what you suggested, so that I don't have to have multiple copies of the same duck. I just load the image while the duck is off screen and then when each duck disappears off the screen I move them to the back of the line.
I have to say that I'm really glad I did the Game Academy. I'd never have figured this stuff out otherwise. What a valuable course that was.
I'm using an image object and then loading the image with the appropriate duck, similar to what you suggested, so that I don't have to have multiple copies of the same duck. I just load the image while the duck is off screen and then when each duck disappears off the screen I move them to the back of the line.
I have to say that I'm really glad I did the Game Academy. I'd never have figured this stuff out otherwise. What a valuable course that was.

Re: Animation Question
The game academy was pretty good. I almost wish they'd have a game academy sequel with yet more great info.
Glad you got it working, 30fps is good enough, and you never know what other ways you'll find to tweak efficiency.
Glad you got it working, 30fps is good enough, and you never know what other ways you'll find to tweak efficiency.