How to make mobs/animals in my game?

I want to make an island-life game called Tiger Island. I want soe crabs to walk around on the beach without hurting the player, but i don’t know how to make ai for crabs. I want them to walk around to random places and pause for a while after getting to their location. Can anybody help me???

If you use the pathfinding behavior, you can make the crabs move some pixels around they actual position.

Something like:

Pathfinding Move Crab to Crab.X()+RandomInRange(-128,128), Crab.Y()+RandomInRange(-128,128).
Repeat while No pathfind
- Pathfinding Move Crab to Crab.X()+RandomInRange(-128,128), Crab.Y()+RandomInRange(-128,128).
If Crab Goal Reached pause.

My way to make it is using a status variable for the mobs so I can change it for Ready (start and after pause so it can walk), Moving (When it is walking so I doesn’t seeks another spot to move), Pause (When they reach their goal and must wait).

There is a Behavior already done for that: “travel to reandom position”!
Just check “search for new Extension”.

I’ll try to understand that, thanks!

Oh! Thanks! I’ll use that.

Thanks @Antani and @oscuridad666! this will help me release Tiger Island in the future.

1 Like