New Bug in Platform Code.

BlitzMax Forums/BlitzMax Beginners Area/New Bug in Platform Code.

While testing a map today I found a quirk in the platform code. Basically the character can walk across a gap without falling.



SuperStrict


Graphics 800 , 600

Global Tiles:TImage = LoadAnimImage("ice_floortiles.png",32,32,0,8)
Global Player:TImage = LoadImage("player.png")


Const MAPWIDTH:Int = 800/32
Const MAPHEIGHT:Int = 600/32

Global Map:Int[MAPWIDTH , MAPHEIGHT]

Global PlayerX:Float 'The players X Location On Screen
Global PlayerY:Float ' The Players Y Location On Screen

Global CheckPlayerPosition:Int = 0 ' A Flag to check the Players Current position. 

Global Direction:Int = -1' The Direction the Player is travelling in

Global Jump:Int = 0 ' Are we Jumping
Const Gravity:Float = 0.2 ' Amount of Gravity to apply to JumpHeight
Global JumpHeight:Float = 5.3' The height The player Jumps in pixels
Global CanJump:Int = 1 ' Whether we can Jump. If we're already jumping we can't jump again ie. double jump.
Global Falling:Int = 0 ' Whether the player is falling. 1 = Falling
'Global Jumping:Int = 0 ' Are we jumping

ReadLevelData() ' We Read the level data

While Not KeyHit(KEY_ESCAPE)
	
	Cls
	
	DrawMap()
	CheckIfPlayerCollideWithTile()
	DrawPlayer()
	MovePLayer()
	DoJump()
	
	
	Flip
	
	
Wend

'######################################################
'#### Function DrawPLayer()							  #
'#### Draws Player to Screen and gets Player Position #
'######################################################
Function DrawPlayer()
	If CheckPlayerPosition = 0 ' We use this to check if there is a number 2 in the tilemap array. If you notice there is a number 2
							   'in the defdata statements. This is used to start the player at that position.		
	For Local x:Int = 0 Until MAPWIDTH ' Loop until MapWidth
		For Local y:Int = 0 Until MAPHEIGHT' Loop Until MapHeight
			Select Map[x,y]' We use a select function to select check data in the MapArray
				Case 2 ' If the data in the map array = 2\/ 
					PlayerX = getX(x) 'we get the location in pixels of the tiles x position and pass it to PlayerX
					PlayerY = getY(y) ' we get the location in pixels of the tiles y position and pass it to PlayerY
					CheckPlayerPosition = 1 ' We switch this to one because we don't want to check the start position of the player anymore
			End Select
		Next
	Next
	EndIf
	DrawText "PlayerX = " +PlayerX , 0 , 20 
	
	DrawImage Player, PlayerX , PlayerY , 0	' Now we have the where the number 2 was in the MapArray and have passed this position
											'to Player X and PlayerY, we use this to draw the player at that location. So if you move the number 2	
											'elsewhere in the defdata statements the player will be drawn according to where it is.
End Function

'#################################################
'###	Function MovePLayer()					 #	
'## 	Moves Player and checks outer boundaries #	
'#################################################
Function MovePLayer()
	
	If KeyDown(KEY_LEFT) And Not KeyDown(KEY_RIGHT)
			Direction = 0 ' set direction to 0. Going Left
			PlayerX:-2 ' Minus 2 from Players X position to move him left
	ElseIf KeyDown(KEY_RIGHT) And Not KeyDown(KEY_LEFT)
			Direction = 1 ' set direction to 1. Going Right
			PlayerX:+2 ' Add 2 to the players X position to move him right
	End If
	
	If PlayerX-32 <=0 ' Boundary checks to prevent our Player Jumping out the screen
		PlayerX:+2
	ElseIf PlayerX >= 800-64 
		PlayerX:-2
	End If
End Function

'##########################################################
'### Function CheckIfPlayerCollideWithTile()			  #
'### Checks to see if the player has collided with a tile #
'### Checks also if the Player is falling                 #
'##########################################################
Function CheckIfPlayerCollideWithTile()
'#Region 
	Select Direction
		Case 1
		If Jump = 0
			If Map[PlayerX/32+1, PlayerY/32] = 1 ' If we put the players X&y position within the map array and divide them by 32
				PlayerX:-2                       ' which is the size of the player and the tiles, we are able to determine which
			EndIf								 ' tile the Player is on or near. if we have a +1 in PlayerX/32+1 or PlayerY/32+1		
		EndIf									 ' it just means we are checking the tiles next to the player. so if we add a +1		
		Case 0									 ' to PlayerY/32 we are checking the tile under the players feet.
		If Jump = 0								 ' In this we are checking the tiles to the right and left and if they = 1 (Tile is present)			
			If Map[PlayerX/32, PlayerY/32] = 1   ' then we stop the player from moving.
				PlayerX:+2
			End If
		EndIf
	End Select
		
'#End Region 

	If Falling = 1 ' If falling = 1 we minus 3.2 from the players Y position making him fall.
		PlayerY:+3.2
		If Map[PlayerX/32,PlayerY/32+1] = 1 ' While he's falling if we check to see if a tile is underneath and if there is
			
			If (PlayerY Mod 32.0) <= 6.4 'checks to see if player is close to top of tile if not keep falling
			                             ' 6.4 is twice the falling distance of 3.2 
				PlayerY = PlayerY - (PlayerY Mod 32) 'subtract the remainder to obtain exact start of tile
				Jump = 0                        ' We stop falling. We reset Jump to 0 and CanJump to 1 and also reset the JumpHeight
				Falling = 0
				CanJump = 1
				JumpHeight = 5.5
			EndIf
		EndIf
	End If

	If Not Map[PlayerX/32+1,PlayerY/32+1] And Not map[PlayerX/32,PlayerY/32+1]  
								' This is used seperately and does nothing apart from enabling me to use the "else bit"
                                ' left of player as well as right of player needs to be checked against 
                                ' the tile so it wont fall of the middle of the tile.
							    ' If there's nothing under the players feet we start falling but only if we're not jumping
		If Jump = 0
			Falling = 1
		EndIf
	End If
	
End Function

'##############################################
'### Function DoJump()                        #
'### Makes our player jump                    #
'##############################################
Function DoJump()
	If KeyHit(KEY_SPACE) And CanJump = 1 ' If we hit the space button and CanJump = 1
		Jump = 1 ' We enable Jump
		CanJump = 0 ' We Disable CanJump. Can't jump while jumping 
	End If
	
	If Jump = 1 ' If Jump is enabled
		PlayerY:-JumpHeight ' we minus JumpHeight from Players Y Position
		JumpHeight:-Gravity ' We minus Gravity from JumpHeight 
		If JumpHeight <=-1.0 Or PlayerY < 32' If JumpHeight <= -1.0  and reached the top tile
			Falling = 1 ' We beging to fall by setting Falling to 1
		EndIf
	End If
	
	
End Function

'########################################
'### Function DrawMap()                 #
'### We Draw the Map to screen          #
'########################################
Function DrawMap()
	For Local x:Int = 0 Until MAPWIDTH ' we loop until MapWidth
		For Local y:Int = 0 Until MAPHEIGHT ' We loop until MapHeight
			Select Map[x,y] ' We select the data stored in the MapArray
				Case 1 ' if it = 1
					DrawImage Tiles , x*32 , y*32 , 0 ' we draw the tiles to there corresponding position
			End Select
		Next
	Next
End Function

'#######################################################
'### Function ReadLevelData()            			   #
'### We read the data stored in the defdata statements #
'#######################################################
Function ReadLevelData()
	For Local y:Int = 0 Until MAPHEIGHT' We loop through the Y position first until MapHeight
		For Local x:Int = 0 Until MAPWIDTH ' We Loop Until MAPWIDTH
			Local data:Int  ' Setup a local variable to store the data in
			ReadData data ' We read the data from the defdata statements in to the data variable
			Map[x,y] = data ' we assign the data in the data variable to our MapArray
		Next
	Next
End Function

'Function getX:Int(x:Int)
'   Return sizeX * x '+ offsetX
'End Function
'
'Function getY:Int(y:Int)
'   Return sizeX * y '+ offsetX
'End Function


Function getX:Int(x:Int)
   Return 32 * x '+ offsetX
End Function

Function getY:Int(y:Int)
   Return 32 * y '+ offsetX
End Function

DefData 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 2, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
DefData 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1


Run this example and you'll see. The CHaracter starts on a platform and when walking right walks over the gaps.

Is there a way to fix this?

Thanks.

If map(mapX,mapY+1)= nothing
playerY = playerY + 1
doLeftandRight = false
end if

Though, it would be a good idea to stop them moving left or right (doLeftandRight) when falling, since they may end up floating through the walls.

I would go through you code, but my head is a shed with my own! :)

Thanks Dabz M8, will give it a go. :)

[edit] I think something similar is already in place. I just tried your method and it doesn't appear to work.

Here's what's in place already.

	If not Map[PlayerX / 32 + 1, PlayerY / 32 + 1]and not Map[PlayerX / 32, PlayerY / 32 + 1]
		If Jump = 0
			Falling = 1
		EndIf
	End If


I kind of need the player to move left and right when falling. It's oart of the game. I will have other types of tile though that when falling or jumping towards, stop the player in his tracks.

:)

ahhh, it seems you are checking below AND across and below...

If not Map[(PlayerX / 32) + 1, (PlayerY / 32) + 1] and not Map[(PlayerX / 32, PlayerY / 32 + 1)]

So if theres one space, it still picks up the block further on, which means you wont fall! :)

Dabz

The thing is that's needed in order for the player to be able to move to the very edge of the tile and when he's past it he falls.

Is there a way to check for instance the outer edges of a tile on it's X axis.

ie if PLayerX is less than >=5 and less than <=27 then a collision is detected. If not he falls. That would fix the issue I think.

I never thought that platform collsion code could be this querky to sort out.

You see games like mario and wonder quite how they did it. :)

yep platform collision code can have many problems. You wait until you add solid walls and ceilings you can hit your head on. Then slopes ... haha :-)

Why not try setting the new coords for the player when they move in a direction (keeping the old ones stored), then do a test for a tile on on both corners (and maybe the middle of the edge) in the direction they are moving. If a tile is detected, reset the coords. This will work for up/down/left/right etc. Also when falling, if you detect you have fallen "into" a tile, you can't just reset the y coord or you'll never land, you need to set the y coord so the player is perfectly on the tile and then change the player graphic to walking and play a landing sound.

Why not try setting the new coords for the player when they move in a direction (keeping the old ones stored), then do a test for a tile on on both corners (and maybe the middle of the edge) in the direction they are moving. If a tile is detected, reset the coords. This will work for up/down/left/right etc. Also when falling, if you detect you have fallen "into" a tile, you can't just reset the y coord or you'll never land, you need to set the y coord so the player is perfectly on the tile and then change the player graphic to walking and play a landing sound.


Can you show me some sample code?

Or can you have a look at the code above a provide some code?

Please. :)

You got my email right? Look at the code for Make Me Happy. I'd love to help more but I'm crazy busy now after returning from 3 weeks of holidays.

I looked at the MakeMeHappy code. I couldn't figure out what you were doing. :)

While playing I noticed that you never had any tiles that were the same distance apart as the width of the character. They were furthere apart than this.

In the platform code above I have a tile, a space and a tile. The distance between them is exactly 32 pixels. This is the width of the player.

Becuase of bounds checking the player canb walk across this gap without falling.

Modifying the bounds checking borks up the whole collision code.

Can anyone else help?

:)

here this is the best I can do with out rewritting your code:

SuperStrict


Graphics 800 , 600

Global Tiles:TImage = LoadAnimImage("ice_floortiles.png",32,32,0,8)
Global Player:TImage = LoadImage("player.png")


Const MAPWIDTH:Int = 800/32
Const MAPHEIGHT:Int = 600/32

Global Map:Int[MAPWIDTH , MAPHEIGHT]

Global PlayerX:Float 'The players X Location On Screen
Global PlayerY:Float ' The Players Y Location On Screen

Global CheckPlayerPosition:Int = 0 ' A Flag to check the Players Current position. 

Global Direction:Int = -1' The Direction the Player is travelling in

Global Jump:Int = 0 ' Are we Jumping
Const Gravity:Float = 0.2 ' Amount of Gravity to apply to JumpHeight
Global JumpHeight:Float = 5.3' The height The player Jumps in pixels
Global CanJump:Int = 1 ' Whether we can Jump. If we're already jumping we can't jump again ie. double jump.
Global Falling:Int = 0 ' Whether the player is falling. 1 = Falling
'Global Jumping:Int = 0 ' Are we jumping

ReadLevelData() ' We Read the level data

While Not KeyHit(KEY_ESCAPE)
	
	Cls
	
	DrawMap()
	CheckIfPlayerCollideWithTile()
	DrawPlayer()
	MovePLayer()
	DoJump()
	
	
	Flip
	
	
Wend

'######################################################
'#### Function DrawPLayer()							  #
'#### Draws Player to Screen and gets Player Position #
'######################################################
Function DrawPlayer()
	If CheckPlayerPosition = 0 ' We use this to check if there is a number 2 in the tilemap array. If you notice there is a number 2
							   'in the defdata statements. This is used to start the player at that position.		
	For Local x:Int = 0 Until MAPWIDTH ' Loop until MapWidth
		For Local y:Int = 0 Until MAPHEIGHT' Loop Until MapHeight
			Select Map[x,y]' We use a select function to select check data in the MapArray
				Case 2 ' If the data in the map array = 2\/ 
					PlayerX = getX(x) 'we get the location in pixels of the tiles x position and pass it to PlayerX
					PlayerY = getY(y) ' we get the location in pixels of the tiles y position and pass it to PlayerY
					CheckPlayerPosition = 1 ' We switch this to one because we don't want to check the start position of the player anymore
			End Select
		Next
	Next
	EndIf
	DrawText "PlayerX = " +PlayerX , 0 , 20 
	
	DrawImage Player, PlayerX , PlayerY , 0	' Now we have the where the number 2 was in the MapArray and have passed this position
											'to Player X and PlayerY, we use this to draw the player at that location. So if you move the number 2	
											'elsewhere in the defdata statements the player will be drawn according to where it is.
End Function

'#################################################
'###	Function MovePLayer()					 #	
'## 	Moves Player and checks outer boundaries #	
'#################################################
Function MovePLayer()
	
	If KeyDown(KEY_LEFT) And Not KeyDown(KEY_RIGHT)
			Direction = 0 ' set direction to 0. Going Left
			PlayerX:-2 ' Minus 2 from Players X position to move him left
	ElseIf KeyDown(KEY_RIGHT) And Not KeyDown(KEY_LEFT)
			Direction = 1 ' set direction to 1. Going Right
			PlayerX:+2 ' Add 2 to the players X position to move him right
	End If
	
	If PlayerX-32 <=0 ' Boundary checks to prevent our Player Jumping out the screen
		PlayerX:+2
	ElseIf PlayerX >= 800-64 
		PlayerX:-2
	End If
End Function

'##########################################################
'### Function CheckIfPlayerCollideWithTile()			  #
'### Checks to see if the player has collided with a tile #
'### Checks also if the Player is falling                 #
'##########################################################
Function CheckIfPlayerCollideWithTile()
'#Region 
	Select Direction
		Case 1
		If Jump = 0
			If Map[(PlayerX+31)/32, PlayerY/32] = 1 ' If we put the players X&y position within the map array and divide them by 32
				PlayerX:-2                       ' which is the size of the player and the tiles, we are able to determine which
			EndIf								 ' tile the Player is on or near. if we have a +1 in PlayerX/32+1 or PlayerY/32+1		
		EndIf									 ' it just means we are checking the tiles next to the player. so if we add a +1		
		Case 0									 ' to PlayerY/32 we are checking the tile under the players feet.
		If Jump = 0								 ' In this we are checking the tiles to the right and left and if they = 1 (Tile is present)			
			If Map[PlayerX/32, PlayerY/32] = 1   ' then we stop the player from moving.
				PlayerX:+2
			End If
		EndIf
	End Select
		
'#End Region 

	If Falling = 1 ' If falling = 1 we minus 3.2 from the players Y position making him fall.
		PlayerY:+3.2
		If Map[PlayerX/32,PlayerY/32+1] = 1 Or Map[(PlayerX+31)/32,PlayerY/32+1]' While he's falling if we check to see if a tile is underneath and if there is
			
			If (PlayerY Mod 32.0) <= 6.4 'checks to see if player is close to top of tile if not keep falling
			                             ' 6.4 is twice the falling distance of 3.2 
				PlayerY = PlayerY - (PlayerY Mod 32) 'subtract the remainder to obtain exact start of tile
				Jump = 0                        ' We stop falling. We reset Jump to 0 and CanJump to 1 and also reset the JumpHeight
				Falling = 0
				CanJump = 1
				JumpHeight = 5.5
			EndIf
		EndIf
	End If

	If Not Map[(PlayerX+31)/32,PlayerY/32+1] And Not map[PlayerX/32,PlayerY/32+1]
								' This is used seperately and does nothing apart from enabling me to use the "else bit"
                                ' left of player as well as right of player needs to be checked against 
                                ' the tile so it wont fall of the middle of the tile.
							    ' If there's nothing under the players feet we start falling but only if we're not jumping
		If Jump = 0 And Not (PlayerX Mod 32.0) 'check if not jumping and at the beggining of a tile
			Falling = 1
		EndIf
	End If
   
End Function

'##############################################
'### Function DoJump()                        #
'### Makes our player jump                    #
'##############################################
Function DoJump()
	If KeyHit(KEY_SPACE) And CanJump = 1 ' If we hit the space button and CanJump = 1
		Jump = 1 ' We enable Jump
		CanJump = 0 ' We Disable CanJump. Can't jump while jumping 
	End If
	
	If Jump = 1 ' If Jump is enabled
		PlayerY:-JumpHeight ' we minus JumpHeight from Players Y Position
		JumpHeight:-Gravity ' We minus Gravity from JumpHeight 
		If JumpHeight <=-1.0 Or PlayerY < 32' If JumpHeight <= -1.0  and reached the top tile
			Falling = 1 ' We beging to fall by setting Falling to 1
		EndIf
	End If
	
	
End Function

'########################################
'### Function DrawMap()                 #
'### We Draw the Map to screen          #
'########################################
Function DrawMap()
	For Local x:Int = 0 Until MAPWIDTH ' we loop until MapWidth
		For Local y:Int = 0 Until MAPHEIGHT ' We loop until MapHeight
			Select Map[x,y] ' We select the data stored in the MapArray
				Case 1 ' if it = 1
					DrawImage Tiles , x*32 , y*32 , 0 ' we draw the tiles to there corresponding position
			End Select
		Next
	Next
End Function

'#######################################################
'### Function ReadLevelData()            			   #
'### We read the data stored in the defdata statements #
'#######################################################
Function ReadLevelData()
	For Local y:Int = 0 Until MAPHEIGHT' We loop through the Y position first until MapHeight
		For Local x:Int = 0 Until MAPWIDTH ' We Loop Until MAPWIDTH
			Local data:Int  ' Setup a local variable to store the data in
			ReadData data ' We read the data from the defdata statements in to the data variable
			Map[x,y] = data ' we assign the data in the data variable to our MapArray
		Next
	Next
End Function

'Function getX:Int(x:Int)
'   Return sizeX * x '+ offsetX
'End Function
'
'Function getY:Int(y:Int)
'   Return sizeX * y '+ offsetX
'End Function


Function getX:Int(x:Int)
   Return 32 * x '+ offsetX
End Function

Function getY:Int(y:Int)
   Return 32 * y '+ offsetX
End Function

DefData 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 2, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
DefData 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1


it will not allways fall and it has to do with the 6.4 test being performed while still moving left or right. if you happen to stop moving at the exact end of the tile then it will fall, such is the case when reaching a wall. you can add a test to only accept movement input when not falling and this will allow falling allways. You can figure that out right?

Thanks Jesse. :)

Yep, when continually walking the player still walks across the gap.

When you said it's the best you could do without rewriting the code, what did you have in mind to rewrite?

You've been very helpful and if you could fix this with a rewrite I would appreciate it. :)

I have no idea what to try to fix this.

Sorry my code wasn't of any help. Basically there are lots of ways to make a platformer and most have some complexity in there somewhere. In some ways you are better off figuring this issue out yourself for the experience points. Good luck!

Sorry my code wasn't of any help. Basically there are lots of ways to make a platformer and most have some complexity in there somewhere. In some ways you are better off figuring this issue out yourself for the experience points. Good luck!



You must have me confused with the amazing Amon. :)

lol, well we all had to learn somehow. In my case it was on 8 bit computers 20+ years ago...I had to relearn a ton of new stuff though when using Blitz Plus and then even more for BMax!

This seems to work. :)

SuperStrict


Graphics 800 , 600

Global Tiles:TImage = LoadAnimImage("ice_floortiles.png",32,32,0,8)
Global Player:TImage = LoadImage("player.png")


Const MAPWIDTH:Int = 800/32
Const MAPHEIGHT:Int = 600/32

Global Map:Int[MAPWIDTH , MAPHEIGHT]

Global PlayerX:Float 'The players X Location On Screen
Global PlayerY:Float ' The Players Y Location On Screen

Global CheckPlayerPosition:Int = 0 ' A Flag to check the Players Current position. 

Global Direction:Int = -1' The Direction the Player is travelling in

Global Jump:Int = 0 ' Are we Jumping
Const Gravity:Float = 0.2 ' Amount of Gravity to apply to JumpHeight
Global JumpHeight:Float = 5.3' The height The player Jumps in pixels
Global CanJump:Int = 1 ' Whether we can Jump. If we're already jumping we can't jump again ie. double jump.
Global Falling:Int = 0 ' Whether the player is falling. 1 = Falling
'Global Jumping:Int = 0 ' Are we jumping

ReadLevelData()  ' We Read the level data

While Not KeyHit(KEY_ESCAPE)
	
	Cls
	
	DrawMap()
	CheckIfPlayerCollideWithTile()
	DrawPlayer()
	MovePLayer()
	DoJump()
	
	
	Flip
	
	
Wend

'######################################################
'#### Function DrawPLayer()							  #
'#### Draws Player to Screen and gets Player Position #
'######################################################
Function DrawPlayer()
	If CheckPlayerPosition = 0 ' We use this to check if there is a number 2 in the tilemap array. If you notice there is a number 2
							   'in the defdata statements. This is used to start the player at that position.		
	For Local x:Int = 0 Until MAPWIDTH ' Loop until MapWidth
		For Local y:Int = 0 Until MAPHEIGHT' Loop Until MapHeight
			Select Map[x,y]' We use a select function to select check data in the MapArray
				Case 2 ' If the data in the map array = 2\/ 
					PlayerX = getX(x) 'we get the location in pixels of the tiles x position and pass it to PlayerX
					PlayerY = getY(y) ' we get the location in pixels of the tiles y position and pass it to PlayerY
					CheckPlayerPosition = 1 ' We switch this to one because we don't want to check the start position of the player anymore
			End Select
		Next
	Next
	EndIf
	DrawText "PlayerX = " +PlayerX , 0 , 20 
	
	DrawImage Player, PlayerX , PlayerY , 0	' Now we have the where the number 2 was in the MapArray and have passed this position
											'to Player X and PlayerY, we use this to draw the player at that location. So if you move the number 2	
											'elsewhere in the defdata statements the player will be drawn according to where it is.
End Function

'#################################################
'###	Function MovePLayer()					 #	
'## 	Moves Player and checks outer boundaries #	
'#################################################
Function MovePLayer()
	
	If KeyDown(KEY_LEFT) And Not KeyDown(KEY_RIGHT)
			Direction = 0 ' set direction to 0. Going Left
			PlayerX:-2 ' Minus 2 from Players X position to move him left
	ElseIf KeyDown(KEY_RIGHT) And Not KeyDown(KEY_LEFT)
			Direction = 1 ' set direction to 1. Going Right
			PlayerX:+2 ' Add 2 to the players X position to move him right
	End If
	
	If PlayerX-32 <=0 ' Boundary checks to prevent our Player Jumping out the screen
		PlayerX:+2
	ElseIf PlayerX >= 800-64 
		PlayerX:-2
	End If
End Function

'##########################################################
'### Function CheckIfPlayerCollideWithTile()			  #
'### Checks to see if the player has collided with a tile #
'### Checks also if the Player is falling                 #
'##########################################################
Function CheckIfPlayerCollideWithTile()
'#Region 
	Select Direction
		Case 1
		If Jump = 0
			If Map[(PlayerX+31)/32, PlayerY/32] = 1 ' If we put the players X&y position within the map array and divide them by 32
				PlayerX:-2                       ' which is the size of the player and the tiles, we are able to determine which
			EndIf								 ' tile the Player is on or near. if we have a +1 in PlayerX/32+1 or PlayerY/32+1		
		EndIf									 ' it just means we are checking the tiles next to the player. so if we add a +1		
		Case 0									 ' to PlayerY/32 we are checking the tile under the players feet.
		If Jump = 0								 ' In this we are checking the tiles to the right and left and if they = 1 (Tile is present)			
			If Map[PlayerX/32, PlayerY/32] = 1   ' then we stop the player from moving.
				PlayerX:+2
			End If
		EndIf
	End Select
		
'#End Region 

	If Falling = 1 ' If falling = 1 we minus 3.2 from the players Y position making him fall.
		PlayerY:+3.2
		If Map[PlayerX/32,PlayerY/32+1] = 1 Or Map[(PlayerX+31)/32,PlayerY/32+1]' While he's falling if we check to see if a tile is underneath and if there is
			
			If (PlayerY Mod 32.0) <= 6.4 'checks to see if player is close to top of tile if not keep falling
			                             ' 6.4 is twice the falling distance of 3.2 
				PlayerY = PlayerY - (PlayerY Mod 32) 'subtract the remainder to obtain exact start of tile
				Jump = 0                        ' We stop falling. We reset Jump to 0 and CanJump to 1 and also reset the JumpHeight
				Falling = 0
				CanJump = 1
				JumpHeight = 5.5
			EndIf
		EndIf
	End If

	If not Map[(PlayerX + 28) / 32, PlayerY / 32 + 1]and not Map[(PlayerX + 4) / 32, PlayerY / 32 + 1]
								' This is used seperately and does nothing apart from enabling me to use the "else bit"
                                ' left of player as well as right of player needs to be checked against 
                                ' the tile so it wont fall of the middle of the tile.
							    ' If there's nothing under the players feet we start falling but only if we're not jumping
		If Jump = 0 'And Not (PlayerX Mod 32.0) ' and not (PlayerX mod 32.0) >=2.0 and not (PlayerX mod 32.0) <=30.0'check if not jumping and at the beggining of a tile
			Falling = 1
		EndIf
	End If
   
End Function

'##############################################
'### Function DoJump()                        #
'### Makes our player jump                    #
'##############################################
Function DoJump()
	If KeyHit(KEY_SPACE) And CanJump = 1 ' If we hit the space button and CanJump = 1
		Jump = 1 ' We enable Jump
		CanJump = 0 ' We Disable CanJump. Can't jump while jumping 
	End If
	
	If Jump = 1 ' If Jump is enabled
		PlayerY:-JumpHeight ' we minus JumpHeight from Players Y Position
		JumpHeight:-Gravity ' We minus Gravity from JumpHeight 
		If JumpHeight <=-1.0 Or PlayerY < 32' If JumpHeight <= -1.0  and reached the top tile
			Falling = 1 ' We beging to fall by setting Falling to 1
		EndIf
	End If
	
	
End Function

'########################################
'### Function DrawMap()                 #
'### We Draw the Map to screen          #
'########################################
Function DrawMap()
	For Local x:Int = 0 Until MAPWIDTH ' we loop until MapWidth
		For Local y:Int = 0 Until MAPHEIGHT ' We loop until MapHeight
			Select Map[x,y] ' We select the data stored in the MapArray
				Case 1 ' if it = 1
					DrawImage Tiles , x*32 , y*32 , 0 ' we draw the tiles to there corresponding position
			End Select
		Next
	Next
End Function

'#######################################################
'### Function ReadLevelData()            			   #
'### We read the data stored in the defdata statements #
'#######################################################
Function ReadLevelData()
	For Local y:Int = 0 Until MAPHEIGHT' We loop through the Y position first until MapHeight
		For Local x:Int = 0 Until MAPWIDTH ' We Loop Until MAPWIDTH
			Local data:Int  ' Setup a local variable to store the data in
			ReadData data ' We read the data from the defdata statements in to the data variable
			Map[x,y] = data ' we assign the data in the data variable to our MapArray
		Next
	Next
End Function

'Function getX:Int(x:Int)
'   Return sizeX * x '+ offsetX
'End Function
'
'Function getY:Int(y:Int)
'   Return sizeX * y '+ offsetX
'End Function


Function getX:Int(x:Int)
   Return 32 * x '+ offsetX
End Function

Function getY:Int(y:Int)
   Return 32 * y '+ offsetX
End Function

DefData 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 2, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1
DefData 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1



:)

sorry, Amon. I guess I was being lazy when I said that. lazy to think some more.

your code seems to works fine now. I hope that's what you want. now, as long as you don't try to work with slopes and maps larger than screen size and moving at different speeds this should be good enough. is it? :)

your code seems to works fine now. I hope that's what you want. now, as long as you don't try to work with slopes and maps larger than screen size and moving at different speeds this should be good enough. is it? :)



It'll do for messing about. But not for a proper platformer.

This method I'm using which you guys have helped me with doesn't appear to be the best solution for making platform games.

It would be good for a game like BomberMan or a top down view sort of RPG but for platformers where there's jumping, falling ect it's not good.

I am eager to learn or to be showed different types of platform collision and setup.

You wouldn't happen to have any other methods for building a platformewr that didn't use tile checking in this way.

"The distance between them is exactly 32 pixels. This is the width of the player."

It's common practice to never have a gap in the tile map that equals the width of a player. If you want a player to fall into a 32 pixel wide gap, then the player should be 30 pixels or less. Making a 32 pixel wide player fall into a 32 pixel wide gap opens up a can of worms in the logic code. If your player is moving anything greater than 1 pixel per frame, think about the coding logistics in that scenario. ;)

Another trick commonly used, is to have a 32 pixel wide player but only code the tile collisions on the middle 30 pixels. This will let you fall into 32 pixel wide gaps easier, etc.

Yeah it's worth having a smaller collision rectangle, although this may mean that you can walk up to a wall and a couple of pixels of the character are drawn in the wall. Mind you TONS of games have done that before so it's no big deal it's artistic licence.

Thanks Guys. I don't think of this stuff when I dive in to coding. It's one of my great failings. :)

You're right when you say that having a CHaracter the same size as a tile is going to cause problems and it has.

I'm going to try and fix it so that the character ius either 16 pixels wide or somewhere in the region of 25 to 30 pixels wide.

I'll post back when I've sussed it out. :)

HI, I've sorted it. The new code takes in to account the Player Width. Modify Player_Width to anything below say 28 and it will take care of the collision.

the Collision is based on the player being 16 pixels wide.

This now works well. It could do with more tweaking to perfect it but that's something I'll do later.

Here's the code.



SuperStrict


Graphics 800 , 600

Global Tiles:TImage = LoadImage("tile.png") 
Global Player:TImage = LoadImage("player1632.png") 



Const MAPWIDTH:Int = 800/32
Const MAPHEIGHT:Int = 600/32

Global Map:Int[MAPWIDTH , MAPHEIGHT]

Global PlayerX:Float
Global PlayerY:Float

Global Player_Width:Int = 16
Global Player_Height:Int = 32

Global CheckPlayerPosition:Int = 0

Global Direction:Int = -1

Global Jump:Int = 0
Const Gravity:Float = 0.2
Global JumpHeight:Float = 5.3
Global CanJump:Int = 1
Global Falling:Int = 0


ReadLevelData() ' We Read the level data

While Not KeyHit(KEY_ESCAPE)
	
	Cls
	
	DrawMap()
	CheckIfPlayerCollideWithTile()
	DrawPlayer()
	MovePLayer()
	DoJump()
	
	
	Flip
	
	
Wend

'######################################################
'#### Function DrawPLayer()							  #
'#### Draws Player to Screen and gets Player Position #
'######################################################
Function DrawPlayer()
	If CheckPlayerPosition = 0 
							   		
	For Local x:Int = 0 Until MAPWIDTH
		For Local y:Int = 0 Until MAPHEIGHT
			Select Map[x, y]
				Case 2
					PlayerX = getX(x) 
					PlayerY = getY(y) 
					CheckPlayerPosition = 1
			End Select
		Next
	Next
	EndIf
	DrawText "PlayerX = " +PlayerX , 0 , 20 
	
	DrawImage Player, PlayerX , PlayerY , 0	
End Function

'#################################################
'###	Function MovePLayer()					 #	
'## 	Moves Player and checks outer boundaries #	
'#################################################
Function MovePLayer()
	
	If KeyDown(KEY_LEFT) And Not KeyDown(KEY_RIGHT)
			Direction = 0
			PlayerX:-2
	ElseIf KeyDown(KEY_RIGHT) And Not KeyDown(KEY_LEFT)
			Direction = 1
			PlayerX:+2
	End If
	
	If PlayerX - 32 <= 0
		PlayerX:+2
	ElseIf PlayerX >= 800 - 32
		PlayerX:-2
	End If
End Function

'##########################################################
'### Function CheckIfPlayerCollideWithTile()			  #
'### Checks to see if the player has collided with a tile #
'### Checks also if the Player is falling                 #
'##########################################################
Function CheckIfPlayerCollideWithTile()
'#Region 
	Select Direction
		Case 1
		If Jump = 0
			If Map[(PlayerX - Player_Width) / 32 + 1, PlayerY / 32]= 1
				PlayerX:-2
			EndIf
		EndIf
		If Jump = 1 and PlayerX >= 784 - 32
			If Map[(PlayerX - Player_Width) / 32 + 1, PlayerY / 32]= 1
				PlayerX:-2
			EndIf
		End If
		Case 0
		If Jump = 0
			If Map[(PlayerX + Player_Width) / 32, PlayerY / 32]= 1
				PlayerX:+2
			End If
		EndIf
	End Select
		
'#End Region 

	If Falling = 1
		PlayerY:+3.2
		If Map[(PlayerX + Player_Width) / 32, PlayerY / 32 + 1]= 1 or Map[(PlayerX - Player_Width * 2) / 32 + 1, PlayerY / 32 + 1]= 1
			
			If (PlayerY mod 32.0) <= 6.4
			                             
				PlayerY = PlayerY - (PlayerY mod 32) 
					
						Jump = 0                        
						Falling = 0
						CanJump = 1
						JumpHeight = 5.5
								
			EndIf
		EndIf
	End If
	
	If not Map[(PlayerX + Player_Width) / 32, PlayerY / 32 + 1]and not Map[(PlayerX - Player_Width * 2) / 32 + 1, PlayerY / 32 + 1]
		If Jump = 0
			Falling = 1
		End If
	End If
	
	
		
End Function

'##############################################
'### Function DoJump()                        #
'### Makes our player jump                    #
'##############################################
Function DoJump()
	If KeyHit(KEY_SPACE) and CanJump = 1
		Jump = 1
		CanJump = 0
	End If
	
	If Jump = 1
		PlayerY:-JumpHeight
		JumpHeight:-Gravity
		If JumpHeight <= - 1.0 or PlayerY < 32
			Falling = 1
		EndIf
	End If
	
	
End Function

'########################################
'### Function DrawMap()                 #
'### We Draw the Map to screen          #
'########################################
Function DrawMap()
	For Local x:Int = 0 Until MAPWIDTH
		For Local y:Int = 0 Until MAPHEIGHT
			Select Map[x, y]
				Case 1
					DrawImage Tiles, x * 32, y * 32, 0
			End Select
		Next
	Next
End Function

'#######################################################
'### Function ReadLevelData()            			   #
'### We read the data stored in the defdata statements #
'#######################################################
Function ReadLevelData()
	For Local y:Int = 0 Until MAPHEIGHT
		For Local x:Int = 0 Until MAPWIDTH
			Local Data:Int
			ReadData Data
			Map[x, y]= Data
		Next
	Next
End Function

Function getX:Int(x:Int)
   Return 32 * x '+ offsetX
End Function

Function getY:Int(y:Int)
   Return 32 * y '+ offsetX
End Function

DefData 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 2, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
DefData 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1


I'd like to thank all who helped me get this working and for their patience.

Hopefully this code will help people with their platform games and help them learn as I did.

Big up to the BRL members. :)

excellent! Now to make Super Amon Brothers.

if you are interested in looking at a remake of Super Mario in blitzmax you can download it from here:
http://www.adam.com.au/therevills/Projects/Mario/Mario%20BlitzMax.exe

it includes working executable and source code minus graphics. it has advanced topics that you might not understand. But maybe it'll help you figure out some ideas on coding it differently.