Menu

scripting wizard question

2004-11-05
2012-12-25
  • Nobody/Anonymous

    when using the scripting wizard to generate a simple jumping script is there a way to set a jump height? the height that the player jumps now is way to low, i opened up the script in the notepad just see if there is something simple i can change, but scripting isnt my thing.

     
    • Ed

      Ed - 2004-11-05

      Sub Player_OnControllerMove(OldActions, NewActions)
         With ProjectObj.GamePlayer.PlayerSprite
            If (Not OldActions) And NewActions And ACTION_BUTTON1 Then
               If (.rDef.SolidTest(.X, .Y + .Height) Or .rDef.SolidTest(.X + .Width - 1, .Y + .Height)) Or (Not .pRideOnRef Is Nothing) Then
                  .DY = - .rDef.Template.MoveSpeed
               End If
            End If
         End With
      End Sub

      is the original code.  Change the following line:

                  .DY = - .rDef.Template.MoveSpeed

      To whatever it is  that you want the speed to be.  Note that that code sets the velocity in the Y direction (.DY) to the negative value of the movement speed of the sprite.  If you want to double the jump height, just change it to

                  .DY = - (.rDef.Template.MoveSpeed * 2)

      Or if you want it to be a constant (say, 4)

                  .DY = -4

      Will do the trick.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.