Discuss Scratch

ab9130
Scratcher
100+ posts

AI Glitch?

On my project, I have a boss that is supposed to move around and try to kill you. I haven't added the fighting yet, but I'm wondering why when the boss is at the same Y Level as you, it starts jumping around randomly. Very strange. Project link:
https://turbowarp.org/639737429
And it might take a while to load.
Another glitch is that it lags horribly when the boss is moving against the wall sometimes. I know that it is because the collision script is confused, because the way it collides. If your velocity is positive/negative, it will collide based on that. If your Velocity is 0 when you collide, The movement script just causes lots of lag because it is trying to find out whether it is positive/negative and it is neither, so it just completely dies. I don't know how to fix this, however. Thank you, bye!

Last edited by ab9130 (Feb. 8, 2022 07:15:15)


forever
delete all of [intelligence v]
end
also look at this
and my studio
Coder046
Scratcher
100+ posts

AI Glitch?

You need to make the AI not change its y-position when its y-position is within a certain range of the player's y-position. If it's moving more than 1 pixel at a time, then it's skipping back and forth over the player's y-position, trying to make it equal when it can't. I haven't seen the project, but as far as I know, that's what's causing the glitch.

() () () <— Enemy
Player
() ()
etc.
(The ovals are the enemy with its AI; as you can see, it's skipping back and forth because it's moving too far. Don't slow down the movement; stop it when it gets close enough.)

[Don't worry, those evil kumquats hate fully written, grammatically correct sentences.]
Hello! I'm Coder046, a Scratcher who likes lists, Minecraft projects (as long as they have more than just a few blocks), and making helpful collections of things such as sounds and costumes collected from the Scratch website. If you need help sorting through lists, please ask. If you need some Minecraft block textures, I may be able to help you.
Here's one of my most viewed projects, with more than 400 views: 2D Minecraft World
Isn't it amazing? I guess that since it has so many blocks (there are 1.16 blocks in there, which I hardly have seen elsewhere), people enjoyed it. Please note that it isn't a tile scrolling game; it's more of a screen-changing platformer.
Here's a 2D Minecraft designer that was used to make the 2D world.
Please contact me if you need help with list or Minecraft things! I have a 2D Minecraft shop now open, along with a Pen Animation shop.
ab9130
Scratcher
100+ posts

AI Glitch?

ok. I'll see if it works

forever
delete all of [intelligence v]
end
also look at this
and my studio
ab9130
Scratcher
100+ posts

AI Glitch?

I already have it stop moving after the distance to player becomes less than 50 in the Y movement script.

forever
delete all of [intelligence v]
end
also look at this
and my studio
Coder046
Scratcher
100+ posts

AI Glitch?

You need this:
((y position) - ((y position v) of (Player v)))
The distance uses the Pythagorean Theorem to get the total distance to the player, in a straight line. You just need the y-difference.

[Don't worry, those evil kumquats hate fully written, grammatically correct sentences.]
Hello! I'm Coder046, a Scratcher who likes lists, Minecraft projects (as long as they have more than just a few blocks), and making helpful collections of things such as sounds and costumes collected from the Scratch website. If you need help sorting through lists, please ask. If you need some Minecraft block textures, I may be able to help you.
Here's one of my most viewed projects, with more than 400 views: 2D Minecraft World
Isn't it amazing? I guess that since it has so many blocks (there are 1.16 blocks in there, which I hardly have seen elsewhere), people enjoyed it. Please note that it isn't a tile scrolling game; it's more of a screen-changing platformer.
Here's a 2D Minecraft designer that was used to make the 2D world.
Please contact me if you need help with list or Minecraft things! I have a 2D Minecraft shop now open, along with a Pen Animation shop.
ab9130
Scratcher
100+ posts

AI Glitch?

Thank you

forever
delete all of [intelligence v]
end
also look at this
and my studio

Powered by DjangoBB