Making a character like the KQ3 cat

Started by Hobo Joe, Tue 03/06/2008 04:19:20

Previous topic - Next topic

Hobo Joe

I'm trying to figure out how to have a cat in my game that randomly switches rooms and moves around, occasionally stopping to clean itself and whatnot. I'm not entirely (or at all) sure on how to go about doing this. Any help would be much appreciated. Thanks!
Yay, I'm Hobo..... Joe...

makerofgamz

Do you have a sprite already made, because that would be the first thing to do. You would need to give the sprite licking animations, walking, etc. You should read the tutorials. They are quite helpful in getting you started.

Hobo Joe

That isn't even remotely helpful. Of course I'm aware that I need the sprites. I suppose I could have been more specific. I need to know what sort of SCRIPTING I need to do to achieve this. I'm fully aware of the need for sprites in a mostly sprite based engine, ...thanks.
Yay, I'm Hobo..... Joe...

monkey0506

#3
The scripting wouldn't be all that difficult. Just make the cat into a Character, then use use the Random function to select a room for the cat to be in any time the player enters a new room. If the cat's in the same room as the player, just tell it where to walk to using the Random function again.

Creating your own characters
Player enters room (before fade-in)
Random
Character.ChangeRoom
Character.Room
Character.Walk

Hobo Joe

Okay, I've figured out how to make it randomly move to different rooms, but I can't figure out what to set up to make it wander around the room. Rather, I can, but either it walks somewhere once and stops, or it walks/turns in place forever. How can I tell it to walk, stop, walk again, etc.?
Yay, I'm Hobo..... Joe...

monkey0506

In repeatedly_execute (global or room script) you could do something like:

Code: ags
if ((cCat.Room == player.Room) && (!cCat.Moving)) { // cat is in the current room and stopped
  cCat.Walk(Random(Room.Width), Random(Room.Height));
}

SMF spam blocked by CleanTalk