Help with new game

I am making a game where you have a team of candy. You can switch between your soldiers, and once you swap, it replaces the person you were playing as with a bot. Have any ideas for making a bot program? Flowlab Game Creator - Sugar Clash

5 Likes

Just make the AI follow the player and attack once an enemy’s nearby ¯_(ツ)_/¯

2 Likes

I would probably just check if it is close enough with Proximity and if it is, make it follow the other bot. From there, you can make it so that while it is touching the other bot, it will take damage at a specified interval.

3 Likes

I would use ray casting over proximity because proximity can often cause lag. If you can switch no matter where the characters are it doesn’t matter. For the bot I would first need to know what it does before I can tell you how to make it.

1 Like

As I said, you will have a team. You can play as one, and you swap between troops. Once you swap, it replaces it with a bot. I would say for their behavior, they would stay close to you. Depending on what class they are in, their behavior is different. Like a swordsman would get up close to the enemy to slash them, and a marksman would stay at a range, and try to shoot them. I will determine more classes.

1 Like

So to make them follow you, I would put in a Switch that turns on once they are a robot, then get the X and Y values of your character, put that into an Expression -(the distance you want them to be from the player). If you put that into a Position behavior they should follow behind the player (or in front depending on what you add in the expression). Then you can use ray casting on the bots to see if there is a jump so that they jump. You can also use ray casting on the bots to see how far it is to an enemy, If it hits an enemy have the bots move in that direction (if you want it to), then have a second ray cast to see how close it is, if it gets really close you can have the bot stop and attack the enemy. For the bot with a bow, it would be a similar thing besides telling it to stay away from the enemy. I would also make the arrow shot from it fall the longer it goes so it’s more realistic (have its position slowly fall). If you need anything else or need to explain something in more depth just ask and I’m happy to help. (this would need to be added inside ever character if you can play as each)

2 Likes

I suppose raycasting would work better. I’ve personally never used it before, as I haven’t needed it.

2 Likes

In the game currently, the bot can get stuck behind something so the player and the bot can get really far apart, just noting something that needs to be fixed.

3 Likes