Discuss Scratch

MitchtheSnazzySpoon
Scratcher
7 posts

How to make a sprite follow you AND face the correct direction?

Hey! I'm making a spinoff Pokemon Mystery Dungeon game and I would like to code the partner pokemon to follow the player. Sadly, all the tutorials I can find are of simple shapes that don't need to turn around and face the right direction.
Like, for example, when my partner is following me, I don't want the sprite to face in one direction the entire time, that would be weird.
Is there a way to do this? I haven't gotten far just yet but I figured that I would try to gather all needed code to get started. The game will be a scrolling x and y map.
Thanks!
-zyx-
Scratcher
16 posts

How to make a sprite follow you AND face the correct direction?

MitchtheSnazzySpoon wrote:

Hey! I'm making a spinoff Pokemon Mystery Dungeon game and I would like to code the partner pokemon to follow the player. Sadly, all the tutorials I can find are of simple shapes that don't need to turn around and face the right direction.
Like, for example, when my partner is following me, I don't want the sprite to face in one direction the entire time, that would be weird.
Is there a way to do this? I haven't gotten far just yet but I figured that I would try to gather all needed code to get started. The game will be a scrolling x and y map.
Thanks!
Not sure what your getting at. possible use the don't rotate block?


| Website | Dribbble | Profile | Projects | Get your project link here for the cost of 1 follow who knows, maybe I will even follow you back.
axisjack
Scratcher
100+ posts

How to make a sprite follow you AND face the correct direction?

In the sprite that follows
point in direction (direction of whatever it is following)
ResExsention
New to Scratch
1000+ posts

How to make a sprite follow you AND face the correct direction?

axisjack wrote:

In the sprite that follows
point in direction (direction of whatever it is following)

Or:

point towards [whatever v]
move (whatever) steps

Infrequently active.

It feels weird to see how far we've come. I hope you're well, wherever you are!
axisjack
Scratcher
100+ posts

How to make a sprite follow you AND face the correct direction?

ResExsention wrote:

axisjack wrote:

In the sprite that follows
point in direction (direction of whatever it is following)

Or:

point towards [whatever v]
move (whatever) steps

Oh yeah that works too. Mine is missing the move blick as well :p
MitchtheSnazzySpoon
Scratcher
7 posts

How to make a sprite follow you AND face the correct direction?

Thanks for answering! But being a noobie, I'm not quite sure how to use the orange variable blocks just yet! Do you mind explaining how to use them?
ResExsention
New to Scratch
1000+ posts

How to make a sprite follow you AND face the correct direction?

MitchtheSnazzySpoon wrote:

Thanks for answering! But being a noobie, I'm not quite sure how to use the orange variable blocks just yet! Do you mind explaining how to use them?

You just hijacked your own thread, lol

Do you know what variables are? Let me explain.

You can think of a variable as a box. IRL, you can put stuff in boxes. However, with variables, apparently, only one thing can fit in the box.

Another way to think of variables is the president of the United States of America. There can be only one person as president, but it can be anybody.

Whatever you put in a variable is called a value. The current value of the president of america variable is Donald Trump. One important thing of variables is that they can be changed. The last value in the president variable was Barrack Obama. Then, using

set [president v] to [Donald Trump]

A short timeline of the last three American presidents using variables:

(year) // the year
(president) // the current president. Basically a box with contents that can be changed

when timeline starts::events hat
set [year v] to [2001]
set [president v] to [George Bush]
set [year v] to [2009]
set [president v] to [Barrack Obama]
set [year v] to [2016]
set [president v] to [Donald Trump]

Do you understand how variables work? They are basically like boxes, and you can put one thing in it. This is extremely useful for stuff like scores, because you can basically go like this:

when green flag clicked
set [score v] to [0]

when I receive [enemy killed v]
change [score v] by (1)

Let me know if you need anything else.

Again, you just hijacked your own thread. Please create your own next time :P

P.S. I'm sorry if you're offended by my using of the presidential office as an analogy for a variable.

Last edited by ResExsention (May 22, 2019 04:22:18)


Infrequently active.

It feels weird to see how far we've come. I hope you're well, wherever you are!
StrangeMagic32
Scratcher
1000+ posts

How to make a sprite follow you AND face the correct direction?

ResExsention wrote:

You just hijacked your own thread, lol

Again, you just hijacked your own thread. Please create your own next time :P
I'm fairly sure that if it still relates to the original topic it's A okay, unless it's someone other than the original topic owner.

MitchtheSnazzySpoon wrote:

Thanks for answering! But being a noobie, I'm not quite sure how to use the orange variable blocks just yet! Do you mind explaining how to use them?
For this you can input whatever value you want, like instead of
(whatever)
you could input 1, 2, 3, 4, ect…


“Remember the worth of souls is great in the sight of God;”
- Doctrine and Covenants 18:10


I have since moved to @JollyWinter
Tallented-Code-bot
Scratcher
100+ posts

How to make a sprite follow you AND face the correct direction?

Try this:
When green flag clicked
forever
point towards[mouse pointer v]// or anything else you want it to follow
move( 10 ) steps// or however many steps you want.
end

Powered by DjangoBB