; Step 1
; Starting with the most simple approach.
; A player with position walking around on the screen.
; And a rectangle as the player, cursor keys to move it.
; Size of player is 20x20 pixels.
Player_SizeX = 20
Player_SizeY = 20
; The player actual position is same as visual position.
; Begin in middle of screen.
Player_PosX = GraphicsWidth () / 2
Player_PosY = GraphicsHeight () / 2
SetBuffer BackBuffer ()
Repeat
If KeyDown ( 200 ) Then Player_PosY = Player_PosY - 1
If KeyDown ( 208 ) Then Player_PosY = Player_PosY + 1
If KeyDown ( 203 ) Then Player_PosX = Player_PosX - 1
If KeyDown ( 205 ) Then Player_PosX = Player_PosX + 1
; Note: player position is the upperleft corner of the rectangle.
; (X,Y)
; \
; O---------+
; | |
; | |
; | |
; | |
; | |
; +---------+
; Orientation is different when for example using an image
; with its handle placed in the middle of the image.
; Image = LoadImage ( "MyImage.BMP" )
; MidHandle Image
; +---------+
; |(X,Y) |
; | \ |
; | O |
; | |
; | |
; +---------+
; By default the image handle is in the upperleft corner.
Rect Player_PosX , Player_PosY , Player_SizeX , Player_SizeY , False
Flip
Cls
Until KeyHit ( 1 )
End