So, I've read around the forum, but I'm still having difficulty with this. When I press rightkey() my character starts animating in the right direction, but my idle sprite doesn't disappear?
Can anyone point out what I'm doing wrong. I'm sure something is wrong with either the SPR_number or IMG_ number. Can someone explain the difference to me? Thank you.
`----------------------------------
` GDP FIGHTING GAME
`----------------------------------
`set manual frame rate and manual frame progression
Sync on : sync rate 50
`set resolution
`must be put here so screen height() is accurate
SET DISPLAY MODE 1280,600, 32
`set animated sprite treansparency
SET IMAGE COLORKEY 255,255,255
`set image directory
set dir "C:\Users\ZEUS\Desktop\DarkBasic Project\GDP GAME\Sprites"
gosub Vars
gosub Init
gosub Engine
Vars:
`declare UDT for sprites
Type SPRITET
x as integer
y as integer
id as integer
endtype
TYPE SPRITES
`player x pos
x as integer
`player y pos
y as integer
`player img number
id as integer
`player sprite number
SPR_NUM as integer
`start frame
FFrame as integer
`Current Frame
CFrame as integer
`Last Frame
LFrame as integer
`responsible for sprite delay value
SPR_Delay as integer
EndType
`sets the following as UDT
background as SPRITET
LevelFloor as SPRITET
player1 as SPRITES
`background variables
background.x = 0
background.y = 0
background.id = 1
`floor variables
`Floor variables 2-5 are designated to tiles if necessary
`cannot use "`sprite height" because sprites are noy yet declared
LevelFloor.x = 0
LevelFloor.y = screen height() - 30
LevelFloor.id = 2
return
PlayerInput:
Anim = 0
`Walking right
if rightkey() = 1
Anim = 1
endif
Return
Anim:
`responsible for animating zero
`animation flag default zero aka idle
If Anim = 0
`changes variables responsible for player animation
player1.SPR_NUM = 10
player1.FFrame = 1
player1.LFrame = 4
player1.SPR_Delay = 100
play sprite player1.SPR_NUM, player1.FFRAME, Player1.LFrame , player1.SPR_Delay
endif
If Anim = 1
player1.SPR_NUM = 11
player1.FFrame = 1
player1.LFrame = 16
player1.SPR_Delay = 100
play sprite player1.SPR_NUM, player1.FFRAME, Player1.LFrame , player1.SPR_Delay
endif
Sprite player1.SPR_NUM, 100,100, 9
return
Init:
`load images
load image "Cubes_Level.jpg", background.id
load image "LevelFloor.jpg", LevelFloor.id
`initialize sprites
Sprite background.id, background.x, background.y, background.id
Sprite LevelFloor.id, Levelfloor.x, Levelfloor.y, Levelfloor.id
`Animated Sprites
create Animated Sprite 10, "Zero idle beta.bmp", 4, 1, 10
Create Animated Sprite 11, "zero running beta2.bmp", 16,1, 11
return
Engine:
Do
`resets animation due to user input
Anim = 0
`positions and places sprites (BG is already initialized as 0
`and does not need to be repasted
Sprite LevelFloor.id, LevelFloor.x, Levelfloor.y, LevelFloor.id
`gets input for character
gosub PlayerInput
`plays animations
gosub Anim
sync
LOOP
return
---------------------
What the h4x...