Hey Im still grasping darkbasic and have been strugling in trying to get animations to work and I thought I had it but unfortunately an error poped up.
I was wondering if anyone could help me please.
The error is Runtime error 2002 - could not load animation at line 88.
(p.s Im aware that this code is not perfect like I said im still learning)
sync on
sync rate 30
hide mouse
set dir "content\textures"
gosub vars
load image "background.jpg", 8
global 8
load image "ground_grass.jpg", 9
global 9
load image "platform.jpg", 10
global 10
REM start of main game loop REM LOOP AREA!!!
DO
anim = 0
sprite playerID,playerx,playery, imgnum
paste image 8 , 0 , 0
sprite ground1,ground1_x,ground1_y,ground1
sprite platform,platform1_x,platform1_y,platform
if jumping = 0
old_y = playery
old_x = playerx
endif
jumpmaxy = old_y + 350
jumpmaxx = old_x + 2
REM GOTO AREA!!!
gosub playerinput
gosub anim
gosub title
gosub gravity
gosub collision
sync
LOOP
vars: REM VARIABLES!!!
REM player and floor variables
rem images
animation2 = 3
animation1 = 2
animation = 1
platform = 10
ground1 = 9
imgnum = 5
playerID = animation
rem images end
rem gravity vars
gravity# = 3
jumping = 0
jumpspeed = 2
falling = 0
rem gravity vars end
rem image vars
platform1_x = 250
platform1_y = 150
ground1_x = 0
ground1_y = 450
playerx = 25
playery = 0
rem image vars end
rem title and such vars
ink RGB(200,0,0), 1
title$ = "gravity"
tx = screen width()
ty = 0
rem title and such vars end
objectP = playerID
rem Camera vars
return
REM animation REM LEVEL ANIMATION!!!
anim:
animid0string$ = "Crono_drinking.gif"
animid1string$ = "Crono_run_right.gif"
animid2string$ = "Crone_run_left.gif"
load animation animid0string$,3
load animation animid1string$,1
load animation animid2string$,2
REM tutorial title variables REM SCOREBOARD!!!
ink RGB(200,0,0), 1
title$ = "gravity"
tx = screen width()
ty = 0
title: REM TITLE!!!
text tx, ty, title$
tx = tx - 1
if tx+text width(title$) < 0
tx = screen width()
endif
if jumping = 0 and falling = 0
text 550, 75, "On ground"
endif
if jumping = 1
text 550, 35, "Jumping"
endif
if jumping = 3
text 550, 50, "Falling"
endif
if falling = 1
text 550, 50, "Falling"
endif
return
gravity: REM GRAVITY!!!
if falling = 1
playery = playery + gravity#
imgnum = 6
endif
if jumping = 1
imgnum = 5
playery = playery - (jumpspeed*3)
endif
if playery >= 5 and jumping = 1
falling = 1
endif
if playery <= jumpmaxy
falling = 1
jumping = 0
endif
if playerx <= jumpmaxx
falling = 1
jumping = 0
endif
return
collision: REM COLLISION!!!
if sprite collision (playerID,ground1) = 1
falling = 0
jumping = 0
playery = playery
endif
if sprite collision (playerID,platform) = 1
falling = 0
jumping = 0
playery = playery
endif
return
playerinput: REM CONTROLS!!!
if rightkey() = 1
if controlkey() = 1 and falling = 0
REM running right
playerx = playerx + 3
endif
playerx = playerx + 2
play animation animation
endif
REM walking left
if leftkey() = 1
if controlkey() = 1 and falling = 0
playerx = playerx - 3
endif
playerx = playerx - 2
if fright = 1
mirror sprite 1
fright = 0
endif
anim = 1
endif
REM jumping
if upkey() = 1 and jumping = 0 and falling = 0
playery = playery - 50
jumping = 1
if rightkey() = 1 then playerx = playerx + 25
if leftkey() = 1 then playerx = playerx - 25
endif
REM player reset
if inkey$() = "r"
playerx = 25
playery = 300
endif
return
Yello http://www.youtube.com/user/Rikukarasuma?feature=mhee