Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    I'm not sure how this works for sprites?

    Beginners
    2
    6
    351
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • poof92
      poof92 last edited by

      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.

      waldron 1 Reply Last reply Reply Quote 0
      • waldron
        waldron F @poof92 last edited by waldron

        @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 screen setspritelocation(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

        poof92 1 Reply Last reply Reply Quote 0
        • poof92
          poof92 @waldron last edited by poof92

          @waldron Yes but how would I get the arrow to go in the direction its pointing?

          waldron 1 Reply Last reply Reply Quote 0
          • waldron
            waldron F @poof92 last edited by

            @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

            1 Reply Last reply Reply Quote 1
            • poof92
              poof92 last edited by

              Thanks I just figured it out!
              I needed to use cos and sin!

              waldron 1 Reply Last reply Reply Quote 2
              • waldron
                waldron F @poof92 last edited by

                @poof92 i had an inkling thats what you were after but i couldn't find the demo for it that vinicity posted

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post