Discuss Scratch

AmgenS
Scratcher
8 posts

Enemy AI without floating?

I'm trying to code enemy AI to follow the player without it floating in a platformer when the player jumps.
TheAnomalousPseudo
Scratcher
1000+ posts

Enemy AI without floating?

Add the same script that your background has to the AI. Then, for the AI movements, just add them on top of the scrolling motion.


We ought to be careful with that octopus that takes over the servers. He's well armed.
AmgenS
Scratcher
8 posts

Enemy AI without floating?

My background scripts only have costume changes and music.
SupergamerExpert
Scratcher
12 posts

Enemy AI without floating?

when green flag clicked
forever
if <((player Ypostion)) > [(Ypositon)]> then
go to x: (Xpostion of player) y: ((Ypostion of the sprite right now))
end
end

This makes it so that if the player jumps the enemy will not float but it will still follow the players Xpostion

Last edited by SupergamerExpert (May 30, 2021 00:51:39)

AmgenS
Scratcher
8 posts

Enemy AI without floating?

when green flag clicked
forever
if <not <touching [ ground] ?>> then
change y by (-1)
end
end

I think thats working.

Last edited by AmgenS (May 30, 2021 14:24:12)

Powered by DjangoBB