Main forum > Bug Reports

tsk it dosnt work or its just my pc?

(1/2) > >>

Hb!:
Sorry to bother in that way... ( I imagine you're gonna start having nightmares with me ja) but since I downloaded the last version of Glbasic.... this simple code doesn't appear to work do you know why?...   or is it really that it only happens with me?

--- Code: (glbasic) ---WHILE TRUE
         delta=delta+1
         IF delta>10
         ani=1-ani
         ani=2-ani
         delta=0
         ENDIF
         DRAWSPRITE ani, -20, 255
         SHOWSCREEN
         WEND
--- End code ---
do you have any idea how to replace it ad yes sorry I dind find ouy how to apply..
--- Code: (glbasic) ---y = y+1
   DRAWSPRITE 100, 100, y
   SHOWSCREEN
goto main
--- End code ---

Kitty Hello:
in the first example, "ani" will count from 0 to infinite. (PRINT ani,0,0)

Usually you want an animation from 0...5 (e.g.), then write:

--- Code: (glbasic) ---ani = MOD(ani + 1, 6) // will make ani from 0 to 5
--- End code ---
if you have a ping-pong (0,1,2,3,2,1,...) animation, do this:


--- Code: (glbasic) ---GLOBAL pingpong[]
DIMDATA pingpong[], 0,1,2,3,2,1
...
ani=ani+1
showani = pingpong[MOD(ani, LEN(pingpong[]) )]
--- End code ---
This might seem a bit complicated in the first. Make sure you know what the MOD command does and then try to understand what I did.

Hb!:
Got it Thanks again... What would I do without Your help? Tsk gotta stop bothering people... disgracefully  ani = mod (ani+1, 6 )
works only with while true.. and that takes the animation out of your hands

Kitty Hello:
Uhm... only within while true... sure, your game needs a main loop. Or, uhm... er... OK?

Hb!:
Is There any way to control it the animation with ani= mod (ani+1 , 6) ? and by the way there isn't a way to stop the infinite number in
--- Code: (glbasic) --- WHILE TRUE
           delta=delta+1
           IF delta>10
           ani=1-ani
           ani=2-ani
           endif
           wend
--- End code ---
? or any better way to make the animations?

Navigation

[0] Message Index

[#] Next page

Go to full version