- Joined
- Oct 29, 2012
- Messages
- 1,474
I was and I am still working on a 2D map about Mario . I have some problems about the gravity and physics .
Well It's all about jump system . This trigger should probably detect what the terrain type is in the bottom of the jumper . But the problem is , It's not really fast enough not to hack the ground . I mean It should stop once the terrain is detected , But the problem is the jumper is stopping sometimes higher than the ground , and some times hacks it , and some times it stops exactly on the ground .
What would the problem be?
I can add this , It may be the cause of the problem :
This stops a jumper from jumping when reaching the ground .
SOLVED
Well It's all about jump system . This trigger should probably detect what the terrain type is in the bottom of the jumper . But the problem is , It's not really fast enough not to hack the ground . I mean It should stop once the terrain is detected , But the problem is the jumper is stopping sometimes higher than the ground , and some times hacks it , and some times it stops exactly on the ground .
-
Set Velocity and Position
-
Events
- Time - Every 0.03 seconds of game time
- Conditions
-
Actions
- Set _IntegerFl_2D = 1
-
For each (Integer A) from 1 to _AmountPlayers_2D, do (Actions)
-
Loop - Actions
- Set _tempPointDXD_2D = (Position of _Hero_2D[_IntegerFl_2D])
- Set _tempPointD2_2D = (_tempPointDXD_2D offset by _BlockDistance2_2D towards 0.00 degrees)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Terrain type at _tempPointD2_2D) Not equal to _GroundStable_2D
-
Then - Actions
-
For each (Integer ForLoopIntegerC) from 1 to NumberOfJumpers, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Grounded[ForLoopIntegerC] Equal to False
-
Then - Actions
- Set Jumpers_Y_Velocity[ForLoopIntegerC] = (Jumpers_Y_Velocity[ForLoopIntegerC] - (g_Acceleration x t_TimeStep))
- -------- Set the new position --------
- Unit - Move _Hero_2D[ForLoopIntegerC] instantly to ((Position of _Hero_2D[ForLoopIntegerC]) offset by ((Jumpers_X_Velocity[ForLoopIntegerC] x t_TimeStep), (Jumpers_Y_Velocity[ForLoopIntegerC] x t_TimeStep)))
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
For each (Integer ForLoopIntegerC) from 1 to NumberOfJumpers, do (Actions)
-
Else - Actions
- Do nothing
-
If - Conditions
- Set _IntegerFl_2D = (_IntegerFl_2D + 1)
-
Loop - Actions
- Custom script: call RemoveLocation( udg__tempPointDXD_2D )
- Custom script: call RemoveLocation( udg__tempPointD2_2D )
-
Events
I can add this , It may be the cause of the problem :
This stops a jumper from jumping when reaching the ground .
-
Stop Jump Ground
-
Events
- Unit - A unit enters H0 <gen>
- Unit - A unit enters H1 <gen>
- Unit - A unit enters H2 <gen>
- Unit - A unit enters H5 <gen>
- Conditions
-
Actions
- Set Stop_Jump_Ground = (Player number of (Triggering player))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Triggering unit) Equal to _Hero_2D[Stop_Jump_Ground]
-
Then - Actions
- -------- Find THE ground (if it hits the ground) --------
- Set Jumpers_Y_Velocity[Stop_Jump_Ground] = 29.43
- Set Grounded[Stop_Jump_Ground] = True
- Set Jumping_No_Up[Stop_Jump_Ground] = False
- Else - Actions
-
If - Conditions
- Set Stop_Jump_Ground = (Stop_Jump_Ground + 1)
-
Events
Last edited: