cant fall off platform. HELP :):)

Blitz3D Forums/Blitz3D Beginners Area/cant fall off platform. HELP :):)

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I looked at the source and found it constantly froze b+. One thing you should look at is not to use the Keyhit command for exiting the program. You can only use the keyhit command once inside a loop. Use keydown.

When your character jumps on top of a platform the collision takes effect. By using this collision and looking at when it does not happen we can tell the program to let the character fall.

Function collision()

	If ImagesCollide (dl,dudeX# + 4,dudeY# + 84,0,pl,px,py,0) Then
		collide = 1
		canjump = 1
		jump = 0
		dudeY# = dudeY# 
		ElseIf dudey<390 And jumpheight =10 Then
		canjump = 1
		jump = 1
		jumpheight = -10
	
	End If

End Function


Look at the ElseIf part. ElseIf we are not on the ground nor on a platform(collision) or not jumping now then set the variables for falling down.

The code looks very neat and organized btw.

Good luck.