PDA

View Full Version : Start of Lunar Lander Game



kryton9
24-07-2009, 02:39
After the new sprite module got released, Frank and I were talking about a game to play with the new features. We have both been distracted, as Frank is working on the lion module and I am still focused on c++. Anyways not wanting to let the little that was done so far go to waste, here is where it was left off at.

Use the arrow keys, up for vertical thrust, left and right arrows for side thrust. Escape to exit.

If the lander goes off the bottom of the screen just keep pressing up arrow, it should pop back up eventually onto the screen. The same for if it goes off of the screen top, just let gravity take it's time in brining it back into view.There is no score tracking of any kind at this point. Just basic movement. So anyone wanting a start on a game, here is one you can finish off. It will be fun to see which direction it goes.

You will need the latest beta version, the stable release is unable to play this at the moment.

Lionheart008
24-07-2009, 03:19
hi kent ! :D

thank you, yes, if there is next week more time we can follow this project. it would be a pleasure to know and find all the possibilities of the new tbgl sprite power features ! mike has done a lot and very good work! :)
I love the 'lunar lander' idea and it's worth to make it better and bigger and the main thing: having fun with this little game demo ! I believe it's a good start...

one info: you can land the space ship at two places for relaxing, find out where ;)

good night, Lionheart

Petr Schreiber
24-07-2009, 12:30
This is very nice start guys!,

there seems to be little problem with inconsistent speed on my PC, I will look into code to check it out.
I would be happy to see you continue this project further if you have time, really nice surprise!

The graphics are great!


Petr

EDIT: With these settings it runs at normal speed on my PC:


'--- +-------------------------------------------------+
'--- | |
'--- | lunar lander |
'--- | by frank brubach & kent sarikaya |
'--- | |
'--- | version alpha 4 |
'--- | date: june 2009 |
'--- | |
'--- | based on example code from |
'--- | mike hartlef |
'--- | |
'--- +-------------------------------------------------+


uses "tbgl"
dim hwnd as dword
dim framerate as double

function tbmain()
local sprbackground, width, height as long
local dirtextures as string = "textures\"
local sprrocket, sprpadlow, sprpadhigh, sprmainthrust, sprsidethrust, sprleftsidethrust as long
local xdiff, x,y, lr as single
local rw, rh as long '--- rocket width and height
%texbackground = 1

'--- create and show window
'--- hwnd = tbgl_createwindowex("tbgl 2d sprite sample (moving sprites) - press esc to quit", 800, 600, 32, %tbgl_ws_fullscreen)
hwnd = tbgl_createwindowex("tbgl 2d sprite sample (moving sprites) - press esc to quit", 1024, 768, 32, %tbgl_ws_fullscreen)
tbgl_getwindowclient(hwnd, width, height)

tbgl_showwindow

'--- load the background texture separately as we want to filter it. loosk better when we stretch a sprite
tbgl_loadtexture (app_sourcepath + dirtextures + "moon4.bmp" , %texbackground , %tbgl_tex_aniso,4)
'--- now create a sprite from the texture
sprbackground = tbgl_spritecreate(%texbackground)

'--- load animated sprites used for thrusters
sprmainthrust = tbgl_spriteloadanim(app_sourcepath + dirtextures + "mainthrust4.tga",32,32)
sprsidethrust = tbgl_spriteloadanim(app_sourcepath + dirtextures + "sidethrust4.tga",16,16)
sprleftsidethrust = tbgl_spriteloadanim(app_sourcepath + dirtextures + "sidethrust4.tga",16,16)
tbgl_spritesetangle (sprleftsidethrust, 180)

'--- load the sprite
sprpadlow = tbgl_spriteload(app_sourcepath + dirtextures + "pad4.tga")
sprpadhigh = tbgl_spriteload(app_sourcepath + dirtextures + "pad4.tga")
sprrocket = tbgl_spriteload(app_sourcepath + dirtextures + "rocket4.tga")
tbgl_spritegetbasesize(sprrocket, rw, rh )

'--- set the xdiff factor which controls the horizontal movement along with framerate
xdiff = 100

'--- set some render states
tbgl_uselighting %false
tbgl_useblend %false

tbgl_usedepth %false
tbgl_usetexture %true
tbgl_usevsync %true

tbgl_usealphatest %true
tbgl_alphafunc %tbgl_greater, 0.1

'--- resets status of all keys
tbgl_resetkeystate()
'--- set the tbgl color to pure white, so colors of sprites are the same like in the texture
tbgl_color 255,255,255
'--- set the background to a dark blue
tbgl_backcolor 0, 0 ,80

'--- now set the sprites position in the middle of the screen
tbgl_spritesetpos(sprbackground,width/2,height/2)


'--- set the size of the sprite to the size of the windows client area
tbgl_spritesetbasesize(sprbackground, width, height )


'--- now set the rocket sprite in the top middle of the screen
tbgl_spritesetpos(sprrocket,width/2,0)

'--- position landing pads according to screen size
if width = 800 then
tbgl_spritesetpos(sprpadhigh,84,405)
tbgl_spritesetpos(sprpadlow,650,635)
elseif width = 1024 then
tbgl_spritesetpos(sprpadhigh,95,518)
tbgl_spritesetpos(sprpadlow,900,795)
end if

'--- initialize left right thrust speed
lr = 0

tbgl_UseVsync(1)
'--- main loop
while tbgl_iswindow(hwnd)
framerate = tbgl_getframerate

'--- set the render matrix to the window clients resolution
tbgl_rendermatrix2d (0, height, width, 0)

'--- not really important to clear a frame here as we draw a background anyway
tbgl_clearframe

'--- with one command you draw all active sprites, even if it is just one :-)
tbgl_spritesdrawall

'--- flip the buffer so you see something on the screen
tbgl_drawframe

'--- determine which key was pressed and then do some action
if tbgl_getwindowkeystate(hwnd, %vk_escape) then exit while

'--- hide sprites not needed to be shown
tbgl_spritesetvisible(sprmainthrust, %false)
tbgl_spritesetvisible(sprsidethrust, %false)
tbgl_spritesetvisible(sprleftsidethrust, %false)

'--- up arrow pressed
if tbgl_getwindowkeystate(hwnd, %vk_up) then
tbgl_spritesetpos(sprrocket,0.0,-xdiff/framerate,%true)
tbgl_spriteaddspeed(sprrocket, +0.24/framerate)
tbgl_spritesetvisible(sprmainthrust, %true)
end if

'--- left arrow pressed
if tbgl_getwindowkeystate(hwnd, %vk_left) then
lr -= 0.1/FrameRate
tbgl_spritesetvisible(sprsidethrust, %true)
end if

'--- right arrow pressed
if tbgl_getwindowkeystate(hwnd, %vk_right) then
lr += 0.1/FrameRate
tbgl_spritesetvisible(sprleftsidethrust, %true)
end if

'--- position rocket
tbgl_spritesetpos( sprrocket,lr,0.0,%true)
tbgl_spriteaddspeed(sprrocket, -0.016/framerate)

'--- position thruster sprites according to rocket
tbgl_spritegetpos(sprrocket,x, y)
tbgl_spritesetpos(sprmainthrust, x, y + rh/2+5)
tbgl_spritesetpos(sprsidethrust, x + rw/2+5, y+rh/2-7)
tbgl_spritesetpos(sprleftsidethrust, x - rw/2-5, y+rh/2-7)
tbgl_spritesupdateall

'--- handle collision
if tbgl_spritecollided(sprrocket, sprpadhigh) or tbgl_spritecollided(sprrocket, sprpadlow) then
tbgl_spritesetspeed(sprrocket,0)
lr=0
end if
wend

'--- now let's clean up the memory
tbgl_spritesdeleteall

tbgl_destroywindow
end function

kryton9
24-07-2009, 22:59
What was happening before Petr? Was it running slow or fast?

Ok, I just ran your version Petr and it is running too slow, stuttering even on my PC. So I assume our version was running too fast on yours.
I have no idea what could be causing this?

Petr Schreiber
24-07-2009, 23:23
Hi Kent,

it was running too fast and some movements were not FrameRate scaled.

Maybe Mike could have a look at this example and tell what is wrong, he knows the sprite system better than anybody else. I think it is simply something related to timing.


Petr

Lionheart008
25-07-2009, 10:42
hi petr, hi kent,

I have tried to make a speed increasing, I hope so, and add a new blue sprite for down arrow key, you can see ;) may be it's not a perfect handling to increase the speed by down key pushing, but this was my idea at this morning...

@kent:
Ok, I just ran your version Petr and it is running too slow, stuttering even on my PC. So I assume our version was running too fast on yours.

@petr:
it was running too fast and some movements were not FrameRate scaled.

it should be possible to handle with framerate scaled and kick the space ship with more speed, therefore I would like to see it with a good performance, don't know what is the best way for it (not yet) ;)




'--- +-------------------------------------------------+
'--- | |
'--- | lunar lander |
'--- | by frank brubach & kent sarikaya |
'--- | |
'--- | version alpha 4a |
'--- | date: june 2009 |
'--- | date: july, 25, 2009 |
'--- | |
'--- | based on example code from |
'--- | mike hartlef |
'--- | |
'--- +-------------------------------------------------+


uses "tbgl"
dim hwnd as dword
dim framerate as double

function tbmain()
local sprbackground, width, height as long
local dirtextures as string = "textures\"
local sprrocket, sprpadlow, sprpadhigh, sprmainthrust, sprsubmainthrust, sprsidethrust, sprleftsidethrust as long
local xdiff, x,y, lr as single
local rw, rh as long '--- rocket width and height
%texbackground = 1

'--- create and show window
'--- hwnd = tbgl_createwindowex("tbgl 2d sprite sample (moving sprites) - press esc to quit", 800, 600, 32, %tbgl_ws_fullscreen)
hwnd = tbgl_createwindowex("tbgl 2d sprite sample (moving sprites) - press esc to quit", 1024, 768, 32, %tbgl_ws_fullscreen)
tbgl_getwindowclient(hwnd, width, height)

tbgl_showwindow

'--- load the background texture separately as we want to filter it. loosk better when we stretch a sprite
tbgl_loadtexture (app_sourcepath + dirtextures + "moon4.bmp" , %texbackground , %tbgl_tex_aniso,4)
'--- now create a sprite from the texture
sprbackground = tbgl_spritecreate(%texbackground)

'--- load animated sprites used for thrusters
sprmainthrust = tbgl_spriteloadanim(app_sourcepath + dirtextures + "mainthrust4.tga",32,32)
sprsubmainthrust = tbgl_spriteloadanim(app_sourcepath + dirtextures + "mainsubthrust5.tga",32,32)
sprsidethrust = tbgl_spriteloadanim(app_sourcepath + dirtextures + "sidethrust4.tga",16,16)
sprleftsidethrust = tbgl_spriteloadanim(app_sourcepath + dirtextures + "sidethrust4.tga",16,16)
tbgl_spritesetangle (sprleftsidethrust, 180)

'--- load the sprite
sprpadlow = tbgl_spriteload(app_sourcepath + dirtextures + "pad4.tga")
sprpadhigh = tbgl_spriteload(app_sourcepath + dirtextures + "pad4.tga")
sprrocket = tbgl_spriteload(app_sourcepath + dirtextures + "rocket4.tga")
tbgl_spritegetbasesize(sprrocket, rw, rh )

'--- set the xdiff factor which controls the horizontal movement along with framerate
xdiff = 100 '25, 50

'--- set some render states
tbgl_uselighting %false
tbgl_useblend %false

tbgl_usedepth %false
tbgl_usetexture %true
tbgl_usevsync %true

tbgl_usealphatest %true
tbgl_alphafunc %tbgl_greater, 0.1

'--- resets status of all keys
tbgl_resetkeystate()
'--- set the tbgl color to pure white, so colors of sprites are the same like in the texture
tbgl_color 255,255,255
'--- set the background to a dark blue
tbgl_backcolor 0, 0 ,80

'--- now set the sprites position in the middle of the screen
tbgl_spritesetpos(sprbackground,width/2,height/2)


'--- set the size of the sprite to the size of the windows client area
tbgl_spritesetbasesize(sprbackground, width, height )


'--- now set the rocket sprite in the top middle of the screen
tbgl_spritesetpos(sprrocket,width/2,0)

'--- position landing pads according to screen size
if width = 800 then
tbgl_spritesetpos(sprpadhigh,84,405)
tbgl_spritesetpos(sprpadlow,650,635)
elseif width = 1024 then
tbgl_spritesetpos(sprpadhigh,95,518)
tbgl_spritesetpos(sprpadlow,900,795)
end if

'--- initialize left right thrust speed
lr += 0.1

tbgl_UseVsync(1)
'--- main loop
while tbgl_iswindow(hwnd)
framerate = tbgl_getframerate

'--- set the render matrix to the window clients resolution
tbgl_rendermatrix2d (0, height, width, 0)

'--- not really important to clear a frame here as we draw a background anyway
tbgl_clearframe

'--- with one command you draw all active sprites, even if it is just one :-)
tbgl_spritesdrawall

'--- flip the buffer so you see something on the screen
tbgl_drawframe

'--- determine which key was pressed and then do some action
if tbgl_getwindowkeystate(hwnd, %vk_escape) then exit while

'--- hide sprites not needed to be shown
tbgl_spritesetvisible(sprmainthrust, %false)
tbgl_spritesetvisible(sprsubmainthrust, %false)
tbgl_spritesetvisible(sprsidethrust, %false)
tbgl_spritesetvisible(sprleftsidethrust, %false)

'--- up arrow pressed
if tbgl_getwindowkeystate(hwnd, %vk_up) then
tbgl_spritesetpos(sprrocket,0.0,-xdiff/framerate,%true)
tbgl_spriteaddspeed(sprrocket, +.25/framerate*8)
tbgl_spritesetvisible(sprmainthrust, %true)
end if

'--- down arrow pressed
if tbgl_getwindowkeystate(hwnd, %vk_down) then
tbgl_spritesetpos(sprrocket,0.0,-xdiff/framerate,%true)
tbgl_spriteaddspeed(sprrocket, -.25/framerate*4)
tbgl_spritesetvisible(sprsubmainthrust, %true)
end if

'--- left arrow pressed
if tbgl_getwindowkeystate(hwnd, %vk_left) then
lr -= 0.1/FrameRate*8
tbgl_spritesetvisible(sprsidethrust, %true)
end if

'--- right arrow pressed
if tbgl_getwindowkeystate(hwnd, %vk_right) then
lr += 0.1/FrameRate*8
tbgl_spritesetvisible(sprleftsidethrust, %true)
end if

'--- position rocket
tbgl_spritesetpos( sprrocket,lr,0.0,%true )
tbgl_spriteaddspeed(sprrocket, -0.025/framerate*8)

'--- position thruster sprites according to rocket
tbgl_spritegetpos(sprrocket,x, y)
tbgl_spritesetpos(sprmainthrust, x, y + rh/2+5)
tbgl_spritesetpos(sprsubmainthrust, x, y - rh/2+5)
tbgl_spritesetpos(sprsidethrust, x + rw/2+5, y+rh/2-7)
tbgl_spritesetpos(sprleftsidethrust, x - rw/2-5, y+rh/2-7)
tbgl_spritesupdateall

'--- handle collision
if tbgl_spritecollided(sprrocket, sprpadhigh) or tbgl_spritecollided(sprrocket, sprpadlow) then
tbgl_spritesetspeed(sprrocket,0)
lr=0
end if
wend

'--- now let's clean up the memory
tbgl_spritesdeleteall

tbgl_destroywindow
end function

'- last edit, saturday, 25.juli.2009 by frank :)


my version I send here as zip file, best regards, all goods for you, Lionheart

kryton9
26-07-2009, 08:31
Frank, on the original, it ran fine on my computer, but too fast on Petr's.
He made a version where he took framerate as a variable, but on mine that stuttered and was too slow on my end.

Mike will have a look and see what he can catch that we are doing wrong.

Michael Hartlef
26-07-2009, 10:31
Hi folks,

like Petr said, the problem here is the proper use of delta timing. Means, all your movement related coding should be modified regarding the framerate. This secures that a game is updating its graphics at the same visual speed on every computer. Here is the code




'--- +-------------------------------------------------+
'--- | |
'--- | lunar lander |
'--- | by frank brubach & kent sarikaya |
'--- | |
'--- | version alpha 4 |
'--- | date: june 2009 |
'--- | |
'--- | based on example code from |
'--- | mike hartlef |
'--- | |
'--- +-------------------------------------------------+


uses "tbgl"
dim hwnd as dword
dim framerate as double

function tbmain()
local sprbackground, width, height as long
local dirtextures as string = "textures\"
local sprrocket, sprpadlow, sprpadhigh, sprmainthrust, sprsidethrust, sprleftsidethrust as long
local xdiff, x,y, lr as single
local rw, rh as long '--- rocket width and height
%texbackground = 1

'--- create and show window
'--- hwnd = tbgl_createwindowex("tbgl 2d sprite sample (moving sprites) - press esc to quit", 800, 600, 32, %tbgl_ws_fullscreen)
'hwnd = tbgl_createwindowex("tbgl 2d sprite sample (moving sprites) - press esc to quit", 1024, 768, 32, %tbgl_ws_fullscreen)
hwnd = tbgl_createwindowex("tbgl 2d sprite sample (moving sprites) - press esc to quit", 1024, 768, 32, %tbgl_ws_windowed or %TBGL_WS_closebox)
tbgl_getwindowclient(hwnd, width, height)

tbgl_showwindow

'--- load the background texture separately as we want to filter it. loosk better when we stretch a sprite
tbgl_loadtexture (app_sourcepath + dirtextures + "moon4.bmp" , %texbackground , %tbgl_tex_aniso,4)
'--- now create a sprite from the texture
sprbackground = tbgl_spritecreate(%texbackground)

'--- load animated sprites used for thrusters
sprmainthrust = tbgl_spriteloadanim(app_sourcepath + dirtextures + "mainthrust4.tga",32,32)
sprsidethrust = tbgl_spriteloadanim(app_sourcepath + dirtextures + "sidethrust4.tga",16,16)
sprleftsidethrust = tbgl_spriteloadanim(app_sourcepath + dirtextures + "sidethrust4.tga",16,16)
tbgl_spritesetangle (sprleftsidethrust, 180)

'--- load the sprite
sprpadlow = tbgl_spriteload(app_sourcepath + dirtextures + "pad4.tga")
sprpadhigh = tbgl_spriteload(app_sourcepath + dirtextures + "pad4.tga")
sprrocket = tbgl_spriteload(app_sourcepath + dirtextures + "rocket4.tga")
tbgl_spritegetbasesize(sprrocket, rw, rh )

'--- set the xdiff factor which controls the horizontal movement along with framerate
xdiff = 100

'--- set some render states
tbgl_uselighting %false
tbgl_useblend %false

tbgl_usedepth %false
tbgl_usetexture %true
tbgl_usevsync %true

tbgl_usealphatest %true
tbgl_alphafunc %tbgl_greater, 0.1

'--- resets status of all keys
tbgl_resetkeystate()
'--- set the tbgl color to pure white, so colors of sprites are the same like in the texture
tbgl_color 255,255,255
'--- set the background to a dark blue
tbgl_backcolor 0, 0 ,80

'--- now set the sprites position in the middle of the screen
tbgl_spritesetpos(sprbackground,width/2,height/2)


'--- set the size of the sprite to the size of the windows client area
tbgl_spritesetbasesize(sprbackground, width, height )


'--- now set the rocket sprite in the top middle of the screen
tbgl_spritesetpos(sprrocket,width/2,0)

'--- position landing pads according to screen size
if width = 800 then
tbgl_spritesetpos(sprpadhigh,84,405)
tbgl_spritesetpos(sprpadlow,650,635)
elseif width = 1024 then
tbgl_spritesetpos(sprpadhigh,95,518)
tbgl_spritesetpos(sprpadlow,900,795)
end if

'--- initialize left right thrust speed
lr = 0

framerate = tbgl_getframerate '<--- this line is important if your framerate inside the mainloop should be
'<--- valid from the very first loop

'--- set the render matrix to the window clients resolution
tbgl_rendermatrix2d (0,height,width,0) '<--- I moved this outside the loop as you don't need to set this every loop
tbgl_spritesetfriction(sprrocket,5) '<--- Set the friction so verticle movement will be reduced each loop.

'--- main loop
while tbgl_iswindow(hwnd)
framerate = tbgl_getframerate

'--- set the render matrix to the window clients resolution
'tbgl_rendermatrix2d (0,height,width,0)

'--- not really important to clear a frame here as we draw a background anyway
tbgl_clearframe

'--- with one command you draw all active sprites, even if it is just one :-)
tbgl_spritesdrawall

'--- flip the buffer so you see something on the screen
tbgl_drawframe

'--- determine which key was pressed and then do some action
if tbgl_getwindowkeystate(hwnd, %vk_escape) then exit while

'--- hide sprites not needed to be shown
tbgl_spritesetvisible(sprmainthrust, %false)
tbgl_spritesetvisible(sprsidethrust, %false)
tbgl_spritesetvisible(sprleftsidethrust, %false)

'--- up arrow pressed
if tbgl_getwindowkeystate(hwnd, %vk_up) then
'tbgl_spritesetpos(sprrocket,0.0,-xdiff/framerate,%true)
'tbgl_spriteaddspeed(sprrocket, +.24/framerate)
tbgl_spriteaddspeed(sprrocket, +60/framerate) '<--- I just changed the value
tbgl_spritesetvisible(sprmainthrust, %true)
end if

'--- left arrow pressed
if tbgl_getwindowkeystate(hwnd, %vk_left) then
'lr -= 0.01
tbgl_spriteaddspeed(sprrocket, +30/framerate,270) '<---- I added this line so all movement is based on Speed
tbgl_spritesetvisible(sprsidethrust, %true)
end if

'--- right arrow pressed
if tbgl_getwindowkeystate(hwnd, %vk_right) then
'lr += 0.01
tbgl_spriteaddspeed(sprrocket, +30/framerate,90) '<---- I added this line so all movement is based on Speed
tbgl_spritesetvisible(sprleftsidethrust, %true)
end if

'--- position rocket
'tbgl_spritesetpos( sprrocket,lr,0.0,%true) '<---- No need to set the vertical position anymore
'tbgl_spriteaddspeed(sprrocket, -.16/framerate)
tbgl_spriteaddspeed(sprrocket, -30/framerate) '<--- I just changed the value

'--- position thruster sprites according to rocket '<--- this could be moved outside the loop and then parent the rocket to the thrust sprites
tbgl_spritegetpos(sprrocket,x, y)
tbgl_spritesetpos(sprmainthrust, x, y + rh/2+5)
tbgl_spritesetpos(sprsidethrust, x + rw/2+5, y+rh/2-7)
tbgl_spritesetpos(sprleftsidethrust, x - rw/2-5, y+rh/2-7)

'tbgl_spritesupdateall
tbgl_spritesupdateall(1/framerate) '<---- this here is very important, update the sprites related to the framerate

'--- handle collision
if tbgl_spritecollided(sprrocket, sprpadhigh) or tbgl_spritecollided(sprrocket, sprpadlow) then
tbgl_spritesetspeed(sprrocket,0)
'lr=0
end if
wend

'--- now let's clean up the memory
'tbgl_spritesdeleteall <--- only call this if you need to delete the sprites during the game. When you exit the code, TBGL will cleanup automatically

tbgl_destroywindow
end function



The most important line change is TBGL_SpritesUpdateAll(1/framerate). This secures that position calculation depending on speed factors are done the same, no matter how fast a computer is.

Edit: I changed the vertical movement to be speed related too. But you can do your old method too, but then the LR variable has to be changed related to the framerate too.

Let me know if it works
Michael

Lionheart008
27-07-2009, 09:38
hi and good morning,

thank you mike for testing and sending a new version according to the supposed framerate problem... :)

your example works good for me, not so fast as our first (or my last one) version, but I noticed at my notebook there seems to be some "flimmering, flattering" at the rocket ... eg. when rocket is standing still for a moment ... tested the script three, four times and now with my desktop pc too...


The most important line change is TBGL_SpritesUpdateAll(1/framerate). This secures that position calculation depending on speed factors are done the same, no matter how fast a computer is.

thank you for this one... I have checked your example this morning and tried different modi with or without framerate related speeds, I am not sure what's the best way... but I can imagine it's important to set the framerate for 'spritesupdateall' for correctly handling, thank you! a new version will come as soon as possible.

I am honest: I am not still perfect with all new tbgl sprite features, it's a lot to learn ;)
I have tested both ways, with the LR variable and without and was surprised that I could do 'spritesupdateall' and setting the old LR variable too

For me my examples running in this way very smooth and rapid, but I cannot compare it with other, faster machines. It's not so easy to find the right way :)


Edit: I changed the vertical movement to be speed related too. But you can do your old method too, but then the LR variable has to be changed related to the framerate too.

nice day, here the sun is already warm and soft, best regards, Lionheart :)
ps: perhaps my new lunar version isn't quite right frame rated and position speed calculated but it's running well for me. any critics at the script are very welcome I would like to learn more about new sprite features ... ;)

Michael Hartlef
27-07-2009, 18:59
Mmmh, flimmering and flattering? Don't know what you mean. I don't see any flimmering. What I see is jumpy movement. That will allways be more visible, the more the new position of a graphic is different from the last position. A difference of 1 pixel for each frame is smooth, even 2 can be considered smooth. The more pixel difference the more the graphic will jump from each position to the next one. Also a low framerate will result in a ore jumpy movement. So the goal is to get high framerates.

kryton9
28-07-2009, 05:11
Thanks Mike, I need to remember to use framerate as a factor. On your example, the movement of the lander was fine, but the animated thrust sprites were only changing every 1/2 second or so.
So that was strange.

Franks your new c version is running fine on mine, both the speed of the lander and thrusters.

Michael Hartlef
28-07-2009, 06:52
The slow animation comes from a slow update factor. Raise the speed of the animation and it should be fine.

There are many ways to get the same result. :)