keep y position constantly increased while standing on a region

Started by jumpjack, Thu 12/01/2023 09:59:37

Previous topic - Next topic

jumpjack

I need that my character Y position is constantly added a fixed quantity as long as character remains inside a region.

I tried with this:

Code: ags
function region1_Standing() {
  //if (!raised) {
    cEgo.y -= 10;
    raised = true;
  //} else {
    // already raised
  //}
}

If  lines are commented, character flickers between "normal" and raised position.
If they are not commented, character Y position is changed only at the beginning, then turns back to the one calculated by pathfinder.

Khris

This is a perfect use case for the .z property; use that instead. Unless that needs to happen in a blocking context, use the region's "walks onto" event to set .z to 10, and the "walks off" event to reset .z back to 0.


SMF spam blocked by CleanTalk