Discuss Scratch

FistMotag
New Scratcher
12 posts

Making a sprite move to another sprite WITHOUT using point

Hey there. I've been making a game for a few weeks now but have finally hit a roadblock.
My sprites are designed to not be pointed in any direction except left or right. If they are pointed, it ruins the game's 8-bit look. They are, however, designed to move in any direction.
I'm trying to make an enemy sprite that follows the player. The problem is, there doesn't seem to be a way to do that without using glide () sec to . While that works, it poses a problem: I can the number of seconds it glides are constant. The player could be on one side of the map and the enemy on the other side, yet the enemy would always glide, let's say, 3 seconds. The enemy could be right next to the player and still glide 3 seconds.
I need to be able to make an enemy glide towards the player without pointing and make him use the same speed.
Thanks.
ResExsention
New Scratcher
1000+ posts

Making a sprite move to another sprite WITHOUT using point

You might use math. The distance to the player would be one operand, and the other would be idk.

Essentially, you need to calculate based on the distance to the player. I'm not exactly sure how you would do this…

I'll experiment.

In the meantime, could you please share your project so we can help you better?
Mesteryman
Scratcher
100+ posts

Making a sprite move to another sprite WITHOUT using point

Try this:

Use this block to make the enemy only appear to be pointing to the left or right.
set rotation style [left-right v]
Then, use this code for the gliding:
forever
point towards [Player v]
move (...) steps
end

This should make the enemy glide a consistent speed towards the player but appear to only be straight to the left or right.

Last edited by Mesteryman (Aug. 5, 2021 22:32:45)

ResExsention
New Scratcher
1000+ posts

Making a sprite move to another sprite WITHOUT using point

Mesteryman wrote:

I don't quite understand what you mean. However, I think this might help:

Use this block to make the enemy only appear to be pointing to the left or right.
set rotation style [left-right v]
Then, use this code for the gliding:
forever
point towards [Player v]
move (...) steps
end

This should help, as the enemy is gliding a consistent speed towards the player but appears to only be straight to the left or right.

I can't wait to see the finished game!

Wow. That seems like it would work. I was dabbling with advanced calculations but you found a simpler solution. Thanks for pointing that out, lol.
FistMotag
New Scratcher
12 posts

Making a sprite move to another sprite WITHOUT using point

Holy cow, it works, thank you!

Last edited by FistMotag (June 5, 2019 03:02:25)

Powered by DjangoBB