Player movement and sprites

BlitzMax Forums/BlitzMax Beginners Area/Player movement and sprites

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

I am trying to code a simple player/sprite movement engine, which will hopefully evolve into my first game as I add more to it. Basically I want to have it so my player moves in 8 directions, viewed from a top-down view.

I am baffled as what to do next. I created some example code to convey what I DO know so far...but it is totally not complete and I gave up halfway for now because I didn't know what else to put.

'*******************************
'*      PLAYER MOVEMENT        *
'*        AND SPRITES          *
'* --------------------------- *
'*  this code does NOT work    *
'*    and is meant only        *
'*    as a demonstration.      *
'*                             *
'*      DO NOT COMPILE         *
'*******************************

' Set up graphics mode
Graphics 640,480,0
SuperStrict' define every variable myself

'******** SPRITES (IMAGES) ********

' Mask all images
SetMaskColor 255,0,255

' Load the player images (4 cardinal directions)
spr_n = LoadAnimImage("n.png",64,64,0,4)' facing up (north)
spr_s = LoadAnimImage("s.png",64,64,0,4)' facing down (south)
spr_e = LoadAnimImage("e.png",64,64,0,4)' facing right (east)
spr_w = LoadAnimImage("w.png",64,64,0,4)' facing left (west)

' Load the player images (4 intermediate directions)
spr_ne = LoadAnimImage("ne.png",64,64,0,4)' diagonal up-right (northeast)
spr_nw = LoadAnimImage("nw.png",64,64,0,4)' diagonal up-left (northwest)
spr_sw = LoadAnimImage("sw.png",64,64,0,4)' diagonal down-left (southwest)
spr_se = LoadAnimImage("se.png",64,64,0,4)' diagonal down-right (southeast)

'******** TYPES ********

' Create the player type
Type t_player
	Field x_pos: Int' x_pos is an integer
	Field y_pos: Int' y_pos is an integer
	Field c_sprite: t_csprite' c_sprite is a type
End Type

' Create the csprite type
Type t_csprite
	Field c_frame: '?
End Type	

' Create new player instance
player:t_player = New t_player


I just want to know how I can have it so the player type holds the values for both the current "state" (walking/standing in different directions...ultimately I'll even add attacking animations, but that comes later) and the current frame of the current animation. Or is there a simpler way to do it? It all just makes my head spin.