#1✎ 20FinnowExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming StrengthZelda Is Awesome!I love The Legend Of Zelda!Express YourselfVideo GamesI like to play video games!HobbiesSo I'm try to make a game where you shoot stuff, and I'm try to do 360 degree aiming. Like, you point somewhere and the bullet goes that direction.
Posted
#2✎ 278ProKukuQSP Contest 1 Contest ParticipantI participated in the first SmileBASIC Source QSP Contest!@randomous's Simple Bullet Tutorial is probably what you're looking for
EDIT: I just remembered that this tutorial only shows how to do shooting in 4 directions. Implementing shooting with the circle pad is fairly complicated to understand, but I know somebody here has already explained the concept on another thread (which I can't find..)
Posted
Edited
by ProKuku
#4✎ 20FinnowExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming StrengthZelda Is Awesome!I love The Legend Of Zelda!Express YourselfVideo GamesI like to play video games!HobbiesI already know how to do most of it, I just need to know what code I use to make my bullets move properly.
Posted
#5✎ 278ProKukuQSP Contest 1 Contest ParticipantI participated in the first SmileBASIC Source QSP Contest!Well, if that's all you need to know, in seggiepants' code, this DEF UPDATE_SHOVEL
VAR X# = SPVAR(CALLIDX, 0)
VAR Y# = SPVAR(CALLIDX, 1)
VAR HEADING# = SPVAR(CALLIDX, 2)
VAR SPEED# = SPVAR(CALLIDX, 3)
VAR STEP# = ((SPEED# * DT%) / 1000.0)
X# = X# + (STEP# * COS(HEADING#))
Y# = Y# + (STEP# * SIN(HEADING#))
IF X# < 0 OR X# > SCREEN_W% OR Y# < 0 OR Y# > SCREEN_H% THEN
SPCLR CALLIDX
ELSE
SPVAR CALLIDX, 0, X#
SPVAR CALLIDX, 1, Y#
SPOFS CALLIDX, X#, Y#
ENDIF
END
is the function specifically used for updating the bullets' location.
Posted
#6✎ 20FinnowExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming StrengthZelda Is Awesome!I love The Legend Of Zelda!Express YourselfVideo GamesI like to play video games!HobbiesSo does this take a number between 0 and 360 and make it move the bullet accordingly? I am bad at math, so I do need a bit of help with this.
Posted
#7✎ 122seggiepantsSIN() and COS() want radians (0.0 to 2 Pi ~6.28), and SPROT wants degrees (0 to 360). You can convert Radians to Degrees with DEG(radians) and Degrees to Radians with RAD(degrees). I have heading# in radians in the example code. The # is me saying that the number is a floating point number (it has a value after the decimal point).
Posted