Discuss Scratch

WILLPR19_
Scratcher
36 posts

Help With Tron Game v3

please ca someone show me how can you make a sprite follow a sprite and move only in straight lines
thanks

Last edited by WILLPR19_ (June 25, 2020 12:50:31)

RL1123
Scratcher
1000+ posts

Help With Tron Game v3

Sprite following sprite:
forever
go to [sprite v]
end

qucchia
Scratcher
100+ posts

Help With Tron Game v3

I suppose that by “straight lines” you mean it can only move left, right, up and down. Here's a simple example of a script that will follow a sprite (in this case it's called Sprite1).

when green flag clicked
forever
repeat until <(x position) > ([x position v] of [Sprite1 v])> // move right
change x by (10)
end
repeat until <(x position) < ([x position v] of [Sprite1 v])> // move left
change x by (-10)
end
repeat until <(y position) > ([y position v] of [Sprite1 v])> // move up
change y by (10)
end
repeat until <(y position) < ([y position v] of [Sprite1 v])> // move down
change y by (-10)
end
end
Wyan100
Scratcher
1000+ posts

Help With Tron Game v3

rayli1123 wrote:

Sprite following sprite:
forever
go to [sprite v]
end


If you do that then it will just stick to whatever it's following. If you want it to actually follow the sprite then you should use glide blocks.

More like this:

forever
glide (1) secs to (character v) :: motion
end
WILLPR19_
Scratcher
36 posts

Help With Tron Game v3

thanks
WILLPR19_
Scratcher
36 posts

Help With Tron Game v3

where is the y posion of sprite one please
WILLPR19_
Scratcher
36 posts

Help With Tron Game v3

found it thx

Powered by DjangoBB