So im on the chapter about sprites in my book, and im having a few difficulties. For one, paste sprite does not work without sync which this book pre-dates so i cant exactly trust its contents as i would not know what sync was from the book, i learned it from some other tutorial and while i dont understand it i was able to sufficiently fix the problem with it.
Now i have not only gone through the chapter but also decided to have a little play of my own. My idea was to use move and rotate sprite under user commands to move a crappy little ship (drawn in less than 6 seconds with 2 arrow tools
) across the screen using only 'w' for forwards, 's' for back and 'a' and 'd' for the angle change. It worked and all was well so i decided to implement a little speed increaser so make the ship not immediately zoom off. So i kind of slow start to full speed boost over a small amount of time. That too was a success as it does work (it looks crap but it does work) but it cant be the best way as i could not think how to do it in a for loop or any other way except sticking the 'w' and 's' in a while loop (see for yourself, its not right).
However it did work so i then decided to place a little starfield background to test it and does it work? No, no it does not. I have read all the stuf on sprites and the blue background but unfortunately it is no use here and no doubt because i am updating my velocity in a while loop. So check it out if you wish and tell me what a fool i am and how i could have done it differently.
Set Display Mode 1280, 1024, 32
Set window position 300, 100
Set Image Colorkey 255, 0, 255
randomize timer()
Load Image "ship.png", 1
Load Bitmap "StarBG.bmp", 0
Sprite 1, 100, 600, 1
set sprite 1, 0, 1 ` without this line the background doesnt show, with it you get the trail
offset sprite 1, 32, 32
ang = 0
Do
If keystate(30) = 1
rotate sprite 1, ang /8
dec ang
Endif
If keystate(32) = 1
Rotate Sprite 1, ang/8
inc ang
Endif
v# = 0.001
b# = -0.001
while keystate(17) = 1 `This cant be the best way of incrementing the velocity as it cuts the whole game off until you let go of the key
If keystate(30) = 1
rotate sprite 1, ang /8
dec ang
Endif
If keystate(32) = 1
Rotate Sprite 1, ang/8
inc ang
Endif
move sprite 1, v#
inc v#, 0.0001
if v# > 0.2 then v# = 0.2
endwhile
while keystate(31) = 1
If keystate(30) = 1
rotate sprite 1, ang /8
dec ang
Endif
If keystate(32) = 1
Rotate Sprite 1, ang/8
inc ang
Endif
move sprite 1, bv#
inc bv#, -0.0001
if bv# < -0.2 then bv# = -0.2
endwhile
Loop
End