Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do I make a sprite slowly turn towards a clone?
- InfiniteCrits
-
17 posts
How do I make a sprite slowly turn towards a clone?
point in direction ((90) - ([arctangent] of (((CloneY) - (Y)) / ((CloneX) - (X))
The script above simply points immediately towards the clone instead of slowly.
Last edited by InfiniteCrits (Sept. 19, 2022 01:31:29)
- InfiniteCrits
-
17 posts
How do I make a sprite slowly turn towards a clone?
Sorry but Arctangent should be in operators form, I'm new to forums.
(I also haven't learned trigonometry yet.)
(I also haven't learned trigonometry yet.)
- legendary34678
-
1000+ posts
How do I make a sprite slowly turn towards a clone?
Hello! RT_Borg made a project where it demonstrated how to smoothly rotate toward an object here.
- InfiniteCrits
-
17 posts
How do I make a sprite slowly turn towards a clone?
But it doesn't cover pointing in the direction of a clone
- legendary34678
-
1000+ posts
How do I make a sprite slowly turn towards a clone?
You can replace the X and Y coordinates with a clone's X and Y coordinates (store in a variable or a list).
- InfiniteCrits
-
17 posts
How do I make a sprite slowly turn towards a clone?
Ok thanks, I will try that.
- mlsecsovm49
-
40 posts
How do I make a sprite slowly turn towards a clone?
have you tried using a list or do thispoint in direction ((90) - ([arctangent] of (((CloneY) - (Y)) / ((CloneX) - (X))
The script above simply points immediately towards the clone instead of slowly.
when green flag clickedfor lists
set [myself v] to [sprite1]
create clone of [myself v]
forever
turn cw (((clone dir) - (direction)) / (6)) degrees
end
when I start as a clone
forever
go to (myself)
point in direction (pick random (1) to (360))
move (pick random (50) to (200)) steps
set [clone dir v] to (direction)
point in direction (90 v)
wait (1) secs
end
when green flag clicked
delete (all v) of [m/d v]
add [sprite1] to [m/d v]
add [0] to [m/d v]
create clone of [myself v]
forever
turn cw (((item (2 v) of [m/d v] :: m/d) - (direction)) / (6)) degrees
end
when I start as a clone
forever
go to (item (1 v) of [m/d v] :: m/d)
point in direction (pick random (1) to (360))
move (pick random (50) to (200)) steps
replace item (2 v) of [m/d v] with (direction)
point in direction (90 v)
wait (1) secs
end
Last edited by mlsecsovm49 (Sept. 19, 2022 12:52:34)
- InfiniteCrits
-
17 posts
How do I make a sprite slowly turn towards a clone?
Yes, I have been using lists instead of variable like:have you tried using a list or do thispoint in direction ((90) - ([arctangent] of (((CloneY) - (Y)) / ((CloneX) - (X))
The script above simply points immediately towards the clone instead of slowly.when I start as a clone
forever
set [clone dir v] to (direction)
end
when green flag clicked
create clone of [myself v]
forever
point in direction (((clone dir) - (direction)) / (3))
end
((90) - ([ atan] of ((((item ( TargetClone#) of [CloneY] :: list)) - (y position)) / (((item ( TargetClone#) of [CloneX] :: list)) - (x position)))))But I have been using the scripts that were linked through the first reply. So I only have need of:
(item ( TargetClone#) of [CloneY] :: list)
Last edited by InfiniteCrits (Sept. 19, 2022 12:41:41)
- Discussion Forums
- » Help with Scripts
-
» How do I make a sprite slowly turn towards a clone?