Discuss Scratch

InfiniteCrits
New Scratcher
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
New Scratcher
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.)
legendary34678
Scratcher
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
New Scratcher
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
Scratcher
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
New Scratcher
17 posts

How do I make a sprite slowly turn towards a clone?

Ok thanks, I will try that.
mlsecsovm49
Scratcher
40 posts

How do I make a sprite slowly turn towards a clone?

InfiniteCrits wrote:

point in direction ((90) - ([arctangent] of (((CloneY) - (Y)) / ((CloneX) - (X))

The script above simply points immediately towards the clone instead of slowly.
have you tried using a list or do this
when green flag clicked
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
for lists
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
New Scratcher
17 posts

How do I make a sprite slowly turn towards a clone?

mlsecsovm49 wrote:

InfiniteCrits wrote:

point in direction ((90) - ([arctangent] of (((CloneY) - (Y)) / ((CloneX) - (X))

The script above simply points immediately towards the clone instead of slowly.
have you tried using a list or do this
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
Yes, I have been using lists instead of variable like:
((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)

Powered by DjangoBB