Hey guys, i'm trying to create a simple 2 player 2d platformer. I found a tutorial for shooting at
http://forum.thegamecreators.com/?m=forum_view&t=58720&b=4 but when i ran some of the code, i had errors. The program compiled, but when ran it said the error was Sprite Number must be greater than 0 at line 131. Here is the code for shooting so far:
If Wait# = 0
If keystate(57) = 1
Sprite B, Sprite X(1) + 200 , Sprite Y(1) + 100 , 20
Offset Sprite B, Sprite Width(1) / 2, Sprite Height(1) / 2
Inc B
Wait# = 20 `fire speed
EndIf
EndIf
Dec Wait#
If Wait# < 0 then Wait# = 0
`*****Redd Fireball Movement*****
For x = 1 to 10
If Sprite Exist(B - x) then Move Sprite B - x, 5 `Move fireball. This is line 131.
If Sprite Exist(B - x) then If Sprite Y(B - x) < 0 then Delete Sprite B - x `Delete fireball if it hits ceiling
If Sprite Exist(B - x) then If Sprite Y(B - x) > 1200 then Delete Sprite B - x `Delete fireball if it hits floor
If Sprite Exist(B - x) then If Sprite X(B - x) > 1600 then Delete Sprite B - x `Delete fireball past 1600px boundary
If Sprite Exist(B - x) then If Sprite X(B - x) < 0 then Delete Sprite B - x
Next x