Ruby's 2d adventure help please

Hi guys
I am following the unity 2d tutorial on Ruby adventures.
I wonder if someone can help me?

I am stuck on chapter 10 Launching the projectile.
I have 2 problems.

First problem is with no input being pressed on the keyboard ruby is always facing up when idling
All of Rubys movement animation is playing correct

Second problem is ruby does not give movement to the cog after it has been instantiated.
I can make the cog move if I am moving as I throw it but when idling it stays put on ruby.
I think it has something to do with the lookdirection but I cant suss it out.

This is driving me nuts please help

1 Like

Hello,
So I am doing the Ruby 2D tutorial for the first time myself. And I’m stuck, I think, on the same part that you are.
Not only did I enter the code myself piece by piece all throughout the tutorial so far, but I’ve also completely copied and pasted the code from the tutorial and I’m still getting the same issue.

I can’t get Ruby to actually fire the cogs:(
Every cog that gets spawned just spawns and stay there. But I see that some of your cogs get launched. I can’t figure out how to fix it.

I got her idling animation working just fine and I’m down to help you out with that part.

Maybe we can put our heads together and figure it out!
-roger

1 Like

Hello @guruleroger
The only reason you see the cogs move in my video is because I am moving when I throw them.
I have debugged LookDirection once it has been passed in to the Launch function. From what I can see in my project is that it is that lookDirection is (0,0) unless I am moving at the time
If you change x or y manually the cog will move

void Launch()
{
GameObject projectileObject = Instantiate(gameobject, Rubybody2d.position + Vector2.up * 0.5f, Quaternion.identity);
Projectile projectile = projectileObject.GetComponent();

lookDirection = new Vector2(1, 0);

projectile.Launch(lookDirection, 300);
animator.SetTrigger(“Launch”);
}
}

@Stew_79 ,

have you made sure that the ‘Projectile’ script is a component of the ‘Cog Bullet’ prefab?

also, I noticed that you declared your ‘lookDirection’ inside of the ‘Launch()’ function. I’m not sure if it matters, but I have ‘lookDirection’ declared at the top of my ‘RubyController’ script with all of my other declarations (i.e. public int maxHealth, bool isInvincible, etc.).

lastly, in ‘Instantiate(…)’, you have ‘gameobject’ at the beginning where ‘projectileObject’ should be.

let me know if that fixes your problem.
sorry it took so long for me to reply; I wonder if there is a way to get notifications from Unity when I get messages.