sword direction?

I’m trying to make my character face up, down, left, right, and I already have the walking animation but I need help with the attacking. My basic idea that I want is to make a projectile that starts and stops right in front of you while the character animation for swinging the plays for all discretion but I have yet to find a way to make it work.

-im already using the animation extension

1 Like

First off… Why did you post the same topic twce?
Anyway, here’s a step-by-step solution (this is what I use):

  1. First, I create a variable named LastDirection (or whatever you wish to call it).
    Screenshot 2024-12-08 10.34.47
  2. Next, I create this piece of code. It changes the LastDirection variable depending on which direction button you last pressed.
  3. Then, I make this big block that, for every time the attack button is pressed (A in my case), checks what the LastDirection was to determine which way the sword will be facing. So, it executes code that shoots the sword as a projectile, with a lifespan of 150 milliseconds, so that the sword disappears after a short stab.

Here is the full project:

2 Likes

i dont know why it posted it twice.
but thanks this helps a lot! ill try

2 Likes

also im new-ish to MakeCode

1 Like