It appears by your indentation that you intend all of this
To do that, you need to take the "Then For jasc=1 To 90" statement off of the IF line and move it down to the next line. You also need an ENDIF statement after the last line like this:
However, none of the above is going to work anyways because you are jumping your camera up 90 units and then down 90 units all within the same frame!
Change your code to something like this:
And then just let your gravity section of code bring him back down :)
If KeyHit(57)=True And jumpflag = False Then For jasc=1 To 90 TranslateEntity camera,+0,+1,+0 Next For jasc=90 To 1 MoveEntity camera,0,-1,0 Next oldtime=MilliSecs() If MilliSecs()< oldtime + 5000 Then jumpflag=True Else jumpflag = Falseto be contained within your If Keyhit(57) condition.
To do that, you need to take the "Then For jasc=1 To 90" statement off of the IF line and move it down to the next line. You also need an ENDIF statement after the last line like this:
If KeyHit(57)=True And jumpflag = False For jasc=1 To 90 TranslateEntity camera,+0,+1,+0 Next For jasc=90 To 1 MoveEntity camera,0,-1,0 Next oldtime=MilliSecs() If MilliSecs()< oldtime + 5000 Then jumpflag=True Else jumpflag = False Endif
However, none of the above is going to work anyways because you are jumping your camera up 90 units and then down 90 units all within the same frame!
Change your code to something like this:
If KeyHit(57)=True And jumpflag = False jumpflag = True oldtime=MilliSecs() Endif If jumpflag = True TranslateEntity camera,+0,+2,+0 ;need 2 units in order to counteract gravity If MilliSecs() > oldtime+500 Then jumpflag=False EndifNotice that we are only moving the camera up. I reduced your jump time to 500ms. I doubt you actually wanted it to jump for 5 whole seconds?
And then just let your gravity section of code bring him back down :)
y#=y#-1Of course, actual gravity increases velocity with time, but what you have here will work for now...