Repeat Character Movements

Started by markcullinane, Tue 29/06/2004 18:26:13

Previous topic - Next topic

markcullinane

I'm busy making a Metal Gear Solid- style 'stealth' sub-game as part of my main game.

In it, 3 cameras placed on the walls are emitting light, represented as a circle of semi-transparent light on the ground. The light moves up and down, and the idea is to quickly pass by the circle of light without it touching you.

I've made the light a character as opposed to an object- this lets me use the MoveCharacterPath function. However, I can only input a certain number of movements up and down of the light before it just stops- adding in more movements in the script makes the game crash, blaming the path is 'too complex'. So what I need is a piece of script which allows repeated, unlimited up and down movement of the character.

I've tried many options but nothing seems to work.
Any ideas?
Thanks

LordHart

#1
You could try doing it with a combo of a GlobalInt and checking where the light is by doing this:
if ((GetGlobalInt(1) == 0) && (character[LIGHT].y) == 20)) { //if the character is at 20Y...
    MoveCharacterPath (LIGHT, character[LIGHT].x, 180); //if the light is set to 0, starts moving down...
    SetGlobalInt(1, 1); //sets the light to 1...
} else if (GetGlobalInt(1) == 1) && (character[LIGHT].y) == 180)) { //if the character is at 180Y...
    MoveCharacterPath (LIGHT, character[LIGHT].x, 20); //if the light is set to 1, starts moving up...
    SetGlobalInt(1, 0); //sets the light to 0...
}
I think that should be it, but I'm not entirely sure.

Ashen

Or, you could use the character[].walking variable, e.g.

In rep_ex of the room:
if (character[LIGHT].walking == 0) {
  MoveCharacter (LIGHT, character[LIGHT].x, 180);
  MoveCharacterPath (LIGHT, character[LIGHT].x, 20);
}

This will check if the light is moving, and as soon as it stops will set it moving again.
I know what you're thinking ... Don't think that.

markcullinane

OK, two good options there- I'll try them both. I'll post back here to say if they worked!

Thanks for the help,
much appreciated as always! :)

markcullinane

Yeah, it worked perfectly! That really, really helps- thanks so much.  ;D

Problem solved.

SMF spam blocked by CleanTalk