Page 1 of 1
Easy jump example
Posted: Sat Dec 23, 2006 1:01 pm
by ChebbyShabby
if you ever wanted to make your sprite jump with simulated physics, i've whipped up a quick example here:
http://www.MailFreeOnline.com/uploader/7004BA98.zip
and for the
slightly more advanced user (involves platforms) -- VERY buggy, quickly done:
http://www.MailFreeOnline.com/uploader/02ABDBBE.zip
(push space bar to jump)
Posted: Sat Dec 23, 2006 4:56 pm
by Derek
Code: Select all
If OpenScreen(640, 480, 32, "Eraser")
LoadSprite(0, "Square.bmp") ;Change this to the location of your sprite
SetFrameRate(60) <------------- insert this line here
Repeat
FlipBuffers()
Might I suggest a small change to your code.
See the line above.
Other than that, very good. Thanks for sharing.
Posted: Sat Dec 23, 2006 6:47 pm
by ChebbyShabby
ah yes... the frame rate. my bad
Posted: Thu Dec 28, 2006 9:36 am
by Michael Vogel
the link is dead

Posted: Thu Dec 28, 2006 10:01 pm
by traumatic
I'm curious, why do you suggest SetFrameRate(), Derek?
Posted: Fri Dec 29, 2006 11:05 am
by Derek
Because the example was moving so fast that it needed to be slowed down. Could of put a delay(1) in the loop or flipbuffers(1) I suppose.
Posted: Fri Dec 29, 2006 11:27 am
by Kaeru Gaman
on most systems you can leave the SetFrameRate() out,
but on some systems it will move too fast without it.
its a rough solution, but it works.
but since FlipBuffers() will use 100%CPU while waiting for the next frame,
the better solution would be to put the whole movement under time-control.
best solution would be seperate threads.
one is timer-controlled and does the movement of the objects,
a second does the display and just runs on maximum framerate, or with a little delay...
Posted: Fri Dec 29, 2006 7:14 pm
by Derek
It was just a quick fix without having to go into timing issues and such, the example was only a quick little program and didn't warrant any major overhauls. Just something to slow it down a bit.
Posted: Fri Dec 29, 2006 7:15 pm
by Derek
Double post - sorry.

Posted: Fri Dec 29, 2006 7:52 pm
by traumatic
Thanks, Derek