I'm not sure how this works for sprites?
-
I've got a bow and the animation now works fine but how do I get the arrow sprite to go in the direction the bow is facing? Its a 2d game im using the sprite commands.
-
@poof92 so to keep it simple use the sprite properties this again is not the best way but will work, so first create another
sprite and name it arrow
you can save time by copying paste the plr sprite and changing the name
to arrow
set the location off screensetspritelocation(arrow,1000,-1000)
, then down by the controls for your player(plr) put
if c.zl and c.zr then setspritelocation(arrow,plr.x,plr.y) setspritespeed(arrow,300, 0) endif
this will draw your bow and shoot an arrow from the players location after pressing both zl and zr.
there are better ways but this will get you going ideally you would want to create a bunch of arrows in a for loop so you can shoot away as this way will only shoot one arrow at a time on the button press -
@waldron Yes but how would I get the arrow to go in the direction its pointing?
-
@poof92 the setspritespeed deals with that
so setspritespeed(arrow,10,0)//will send the arrow right
setspritespeed(arrow,-10,0)//left
setspritespeed(arrow,0,10)//down
setspritespeed(arrow,0,-10)//up -
Thanks I just figured it out!
I needed to use cos and sin! -
@poof92 i had an inkling thats what you were after but i couldn't find the demo for it that vinicity posted