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.
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.
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)
- Events
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)
- Events
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.