So I have a Spaceship game, or the early shell of one, and I am trying to get the player to draw. There are four parts to the player, it's type, start function, frame function, and draw function. With each function you just provide the type variable and it works with it. My problem, however, is that the sprite in the draw function is not being drawn. I tried to draw a rectangle to see if it was working, and it was. But the sprite refuses to be drawn.
Here is the code (Sorry for the amount):
//This is the player's stuff
//For sprites
#include "Sprites.agc"
#include "Functions.agc"
type oPlayer
x as float
y as float
spriteIndex as integer
hsp as float
vsp as float
endtype
//Start the player
function playerStart(playerObject as oPlayer)
//Movement stuff
playerObject.x = 0
playerObject.y = 0
playerObject.hsp = 0
playerObject.vsp = 0
//Set the player's basic values
playerObject.spriteIndex = LoadSprite("SprPlayer.png")
//Start the player in the middle
playerObject.y = 540 / 2
endfunction
//Will be executed every frame
function playerFrame(playerObject as oPlayer)
//Set the player's position
playerObject.y = playerObject.y + getDirectionX() * 10
SetSpritePosition(1, 100, playerObject.y)
//Clamp it's playerObject.y
playerObject.y = clamp(playerObject.y, 0, 540 - GetSpriteHeight(1))
endfunction
function playerDraw(playerObject as oPlayer)
//Set the sprite's position to the player's position
SetSpritePosition(playerObject.spriteIndex, playerObject.x, playerObject.y)
//Draw the final sprite
DrawSprite(playerObject.spriteIndex)
endfunction
One thing to note is that this is all included in the main file using #include.
I've got no idea what I did wrong, could you please tell me what I did wrong?. Any help is greatly appreciated.
Gamejolt: http://gamejolt.com/profile/united-calamity/575975