プレイ日記
Jacob KulcakKid4
What's the best way to get accurate arrow firing, like, not just 8 directions, but all directions, using the circle pad (and probably pressing A or Y to fire) is there any way to do this with a sprite? if so, can someone show me how to do this? *Commercial man*:This may or may not be a favor for J.P.Side effects may vary: Loss of sight or hearing, unexpected vomiting,and in severe cases,DEATH. JK
2そうだね
プレイ済み
返信[1]
親投稿
PChicken NerdChicken
uh, do the arrows need to drop? if they don't, you can just use the STICK OUT SX,SY to move the arrow normally.
1そうだね
プレイ済み
返信[2]
親投稿
*J.P.* DEV NEWPICY3
well the arrows need to go out from the middle in the direction the circle pad is facing. its in an above viewpoint so it just goes out and doesn't drop (maybe later ill add slowing down idk)
0そうだね
未プレイ
返信[3]
親投稿
Jacob KulcakKid4
Umm. Yeah, I guess I'll have to comment so you know J.P answered.
1そうだね
プレイ済み
返信[4]
親投稿
*J.P.* DEV NEWPICY3
lol I guess so..
0そうだね
未プレイ
返信[5]
親投稿
*J.P.* DEV NEWPICY3
update' I have the moving and facing directions but I just need the arrow to move continuously in one direction
0そうだね
未プレイ
返信[6]
親投稿
Jacob KulcakKid4
Umm...... yeaaaahhhhh
0そうだね
プレイ済み
返信[7]
親投稿
Jacob KulcakKid4
Man, I love being the third wheel.
0そうだね
プレイ済み
返信[8]
親投稿
*J.P.* DEV NEWPICY3
ok im just going to go on PChickens profile and go on one of his posts
0そうだね
未プレイ
返信[9]
親投稿
Jacob KulcakKid4
I know I'm probably not the one to talk, but I'm pretty sure the circle pad only goes in 8 directions...hmmm. Maybe you could put if the circle pad moves left, the sprite rotates left with SPROT? Idk
0そうだね
プレイ済み
返信[10]
親投稿
Jacob KulcakKid4
Ok
0そうだね
プレイ済み
返信[11]
親投稿
*J.P.* DEV NEWPICY3
no it goes all directions, and I know how to use it to move a sprite at any angle but im trying to make a sprite follow I line that was- ugg im simplest terms: you will push the circle pad in the direction you wish the arrow to go,then press Y to fire, then it will fire in that direction. tho I think I need to use trigonometry fun fact:97% of humans don't actually read the word " trigonometry"
1そうだね
未プレイ
返信[12]
親投稿
*J.P.* DEV NEWPICY3
but its complicated beyond me so I need help
1そうだね
未プレイ
返信[13]
親投稿
PChicken NerdChicken
If there is no drop, just use the SX and SY at time of launch to increase the coordinates of the arrow sprite, and you can get the angle to set the arrow sprite as by doing DEG(ATAN(SY,SX)). The only trig you'll have to do in either way is just that ATAN bit to calculate the angle of the arrow. If you want realistic arrow physics, you'll have to worry about the velocity and calculate the -cont-
0そうだね
プレイ済み
返信[14]
親投稿
PChicken NerdChicken
angle every frame. How do you do velocity, you say? Well, on launch, you take the SX and SY values, multiply them by a number to make them bigger, and put them in a separate variable called VX and VY (or whatever you want). Now, let's add a simple bit of code to move your sprite. Use SPOFS ID OUT X,Y to get the position of your sprite. Then put in a little SPOFS ID,X+VX,Y-VY+G What is the G -cont-
0そうだね
プレイ済み
返信[15]
親投稿
PChicken NerdChicken
for, you may ask? It is a premade constant you put in the beginning of your code (outside your loop) to hold the amount of Gravity that pulls down your arrow. I like to put mine at 5. Now, we should probably set the rotation of the sprite with SPROT ID,DEG(ATAN(-VY-G,VX)). Next, we'll need to chip away at that velocity of the arrow bit by bit. Put in a VX=VX*0.98 and the same with VY.
0そうだね
プレイ済み
返信[16]
親投稿
PChicken NerdChicken
Organizing this code into a executable order may be a little bit confusing, so: ACLS SPSET 0,117 SPHOME 0,8,8 'set the middle of the sprite to the middle SPOFS 0,20,200 G=5 WHILE TRUE STICK OUT SX,SY IF !SHOT THEN SPROT 0,DEG(ATAN(-SY,SX)) IF BUTTON() AND #Y THEN SHOT=TRUE VX=SX*9 VY=SY*18 ENDIF
0そうだね
プレイ済み
返信[17]
親投稿
PChicken NerdChicken
IF SHOT THEN SPOFS 0 OUT X,Y SPOFS 0,X+VX,Y-VY+G SPROT 0,DEG(ATAN(-VY-G,VX)) VX=VX*0.98 VY=VY*0.98 WEND
0そうだね
プレイ済み
返信[18]
親投稿
Jacob KulcakKid4
J.P....he responded *walks around* *innocently whistles*
0そうだね
プレイ済み
返信[19]
親投稿
*J.P.* DEV NEWPICY3
*reads massive chunk of information* great, now lets let that set in my brain for a few hours and then see what comes of it. anyways was gone mostly today (to surprise grandma) and worked on my game, mainly made it more awesome by making rain EPIC and making it slow down the player and have lightning and do stuff! (not yet added sound btw) anyways!
0そうだね
未プレイ
返信[20]
親投稿
PChicken NerdChicken
if anyone was a third wheel here, it was probably J.P. anyways, bugfix i need to give: add AND !SHOT to the IF BUTTON() AND #Y line. if you don't, you can control the arrow by holding y and moving the circle pad.
0そうだね
プレイ済み
返信[21]
親投稿
PChicken NerdChicken
ACK! For crying out loud, I gave a broken bugfix! add && !SHOT instead of AND !SHOT. otherwise you won't be able to shoot any arrows at all.
0そうだね
プレイ済み
返信[22]
親投稿
Jacob KulcakKid4
Darn. I was enjoying being the third wheel.
0そうだね
プレイ済み
返信[23]
親投稿
*J.P.* DEV NEWPICY3
haha lol but your still the 3rd wheel. btw @PChicken im banned on my 3ds so thats why he made this for me.
1そうだね
未プレイ
返信[24]
親投稿
*J.P.*[P]£ aj2003aj
oh lol no wonder I couldn't find it lol, its on your post!
0そうだね
プレイ済み
返信[25]
親投稿
Jacob KulcakKid4
Lol this will definitely save me some time! I completely forgot about it.
2そうだね
プレイ済み
返信[26]
親投稿
*J.P.* DEV NEWPICY3
i know! now to see if it work as i never tested it lol.
2そうだね
プレイ済み
返信[27]
親投稿
Jacob KulcakKid4
Oh, you're going to do the shooting? I thought you were working on your game lol.
0そうだね
プレイ済み
返信[28]
親投稿
*J.P.*[P]£ aj2003aj
well you know when your making a game then suddenly everything goes blank..? all your ideas and everything..? well that kind of happened to me so ill do I, though lol im busy right now so in a bit
1そうだね
プレイ済み