Hi Guys, Im having a little problem trying to make the following:
Im trying to make a platforming game, where im using spritesheets as animations, i want the character to move left and right, then change animations depending of which position is the character facing
The code is a mess and i did not put any input code yet, but i need a way to switch animations when, for instance the left or right key are pressed, then stop the animation when the buttons are unpressed
theres the sample, messy code, where depending of the variable "Cuurian" (character's name) is the animation it shows.
// Project: Cuurian
// Created: 2016-05-15
// set window properties
SetWindowTitle( "Cuurian" )
SetWindowSize( 640, 480, 0 )
// set display properties
SetVirtualResolution( 320, 240 )
SetOrientationAllowed( 1, 1, 1, 1 )
// X and Y Coordinates of player
PlayerX=20
PlayerY=20
// create a sprite with ID that has no image
Cuurian=3
//Load Background image, Image 5 is reserved for background pic
BG = LoadImage ( "Bg1.png" )
back = CreateSprite ( BG )
select Cuurian
case 1
LoadImage ( 1, "CuurianPI.png" )
CreateSprite ( Cuurian, 1 )
SetSpritePosition ( Cuurian, PlayerX, PlayerY )
SetSpriteAnimation ( Cuurian, 58, 98, 60 )
endcase
case 2
LoadImage ( 2, "CuurianCI.png" )
CreateSprite ( Cuurian, 2 )
SetSpritePosition ( Cuurian, PlayerX, PlayerY )
SetSpriteAnimation ( Cuurian, 82, 107, 60 )
endcase
case 3
LoadImage ( 3, "CuurianCD.png" )
CreateSprite ( Cuurian, 3 )
SetSpritePosition ( Cuurian, PlayerX, PlayerY )
SetSpriteAnimation ( Cuurian, 82, 107, 60 )
endcase
case 4
LoadImage ( 4, "CuurianPD.png" )
CreateSprite ( Cuurian, 4 )
SetSpritePosition ( Cuurian, PlayerX, PlayerY )
SetSpriteAnimation ( Cuurian, 58, 98, 60 )
endcase
endselect
PlaySprite ( Cuurian, 60, 1, 1, 60 )
do
Sync ( )
loop
thanks in advance