wall detect bounce problem

NightShade

Ultra Cool Member
Reaction score
31
Yesterday I decided to make a 2D platform game. To make the game slightly different I decided to make the game revolve around the player bouncing (not jumping) off of things, so I made these triggers to do so.

Trigger:
  • bounce y
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
      • ((Terrain type at ((Position of Player_Unit) offset by (0.00, 1.00))) Equal to (Terrain type at Region000_Point)) or ((Terrain type at ((Position of Player_Unit) offset by (0.00, -1.00))) Equal to (Terrain type at Region000_Point))
    • Actions
      • Set grav = (grav x -1.00)
      • Set grav = (grav - 0.05)

Trigger:
  • bounce x
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
      • ((Terrain type at ((Position of Player_Unit) offset by (1.00, 0.00))) Equal to (Terrain type at Region000_Point)) or ((Terrain type at ((Position of Player_Unit) offset by (-1.00, 0.00))) Equal to (Terrain type at Region000_Point))
    • Actions
      • Set playerwant = (playerwant x -1.00)
      • Set playerwant = (playerwant - 0.05)

grav is how much the player unit moves every 0.01 seconds on the y axis, and playerwant is the same on the x axis.

The reason I don't just use the position of player unit as part of the condition is because then both triggers will go off at the same time, so even if the player unit touches a wall meanwhile going up, they will come away going down. The problem I have is that both triggers will still both run when the unit gets close to the trim grass. Sometimes it will run properly though, which just confuses me. Does anybody know why this might be, and how to fix it?

Oh and the Set variable = (variable - 0.05) is just there to fix a bug in the ordering of the triggers that caused the unit to come away with 0.05 more movement.

+rep will, naturally, be rewarded.
 

Cheddar

This is the way it was meant to be.
Reaction score
126
Is the unit possibly staying on the terrain type for two different intervals when the trigger runs? Have the game display a message every time one of those triggers goes off to count how many times the variables change.
 

Cheddar

This is the way it was meant to be.
Reaction score
126
Well, can you post a picture of the map? "Close to the trim grass" means nothing at the moment except it seems the trim grass is where you want it to bounce.
 

NightShade

Ultra Cool Member
Reaction score
31
Well, can you post a picture of the map? "Close to the trim grass" means nothing at the moment except it seems the trim grass is where you want it to bounce.
By close I mean 1 unit away, where the trigger will then run. And by trim grass I mean the terrain at region000point, so the terrain which the unit will bounce off of.

Oh btw, are the units of measurement used by the editor 1 square or 100th of 1 square?

edit: oops, the units are 100th of a square, and the unit gets well above 1 100th of a square each 0.01 seconds. feel so stupid now. The problem is fixed.
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top