Author Topic: tsk it dosnt work or its just my pc?  (Read 5712 times)

Hb!

  • Guest
tsk it dosnt work or its just my pc?
« on: 2007-Oct-18 »
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) [Select]
WHILE TRUE
         delta=delta+1
         IF delta>10
         ani=1-ani
         ani=2-ani
         delta=0
         ENDIF
         DRAWSPRITE ani, -20, 255
         SHOWSCREEN
         WEND
do you have any idea how to replace it ad yes sorry I dind find ouy how to apply..
Code: (glbasic) [Select]
y = y+1
   DRAWSPRITE 100, 100, y
   SHOWSCREEN
goto main

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10839
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
tsk it dosnt work or its just my pc?
« Reply #1 on: 2007-Oct-18 »
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) [Select]
ani = MOD(ani + 1, 6) // will make ani from 0 to 5if you have a ping-pong (0,1,2,3,2,1,...) animation, do this:

Code: (glbasic) [Select]
GLOBAL pingpong[]
DIMDATA pingpong[], 0,1,2,3,2,1
...
ani=ani+1
showani = pingpong[MOD(ani, LEN(pingpong[]) )]
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!

  • Guest
tsk it dosnt work or its just my pc?
« Reply #2 on: 2007-Oct-19 »
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

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10839
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
tsk it dosnt work or its just my pc?
« Reply #3 on: 2007-Oct-19 »
Uhm... only within while true... sure, your game needs a main loop. Or, uhm... er... OK?

Hb!

  • Guest
tsk it dosnt work or its just my pc?
« Reply #4 on: 2007-Oct-19 »
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) [Select]
WHILE TRUE
           delta=delta+1
           IF delta>10
           ani=1-ani
           ani=2-ani
           endif
           wend
? or any better way to make the animations?

Hb!

  • Guest
tsk it dosnt work or its just my pc?
« Reply #5 on: 2007-Oct-20 »
tsk I could have found this before ~~ boku no baka...
Code: (glbasic) [Select]
FOR n=0 TO 3

DRAWSPRITE n, 100, 100

SHOWSCREEN
NEXT
you can give values to n from 1 to the infinite and it gives you the animation anyways... and by the way this one doesn't cause the problem I had of the error window , and you can repeat this with another variable , I think it ill work excellent.... what do you think about it? and just one question if you compile this code a blue line is drawn? in my case it doesn't matter(its covered by the demo sign) by the moment, but what would happen with the full version? and do you think that a transparent line in that place would fix it?

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1793
    • View Profile
    • Homepage
tsk it dosnt work or its just my pc?
« Reply #6 on: 2007-Oct-20 »
The blue line should be the time left until the demo exits, you only have 2 minutes to test your game. That one will be gone together with the demo sign when you buy the licence