I am sorry I am a new to programing. Bellow is what I have updated but I am still haveing promlems.
-Problem 1: I can't get arno to face the direction that he is moveing.
-Problem 2: I cant get my spider to move a little distance automaticly.
-Problem 3: I cant get my sprite collision between arno and spider to work.
Thank you very much for being pateint with a rookie.
REMSTART --------------------------------------------
Author : Katz Sprite Demo
Version : 002
Creation Date : Sat Oct 28 2006
Created for DBP[ x ] | DBC[ ]
Description : Move arno sprite move with arrowpad. Move spider sprite either up and down or left and right automaticly.
Make a collision between arno and spider sprites exit the game.
Testing Sprite handling
Notes:
Cleaned up code, isolated command position errors
REMEND
REM SETUP ----------------------------
set display mode 1024, 768, 32
sync on : sync rate 60 : hide mouse
set text font "verdana" : set text size 14 : ink rgb(255,255,255),1
REM INIT / LOAD SPRITES ----------------------------
set image colorkey 220, 220, 220
REM arno sprite
create animated sprite 1, "arno.bmp", 8, 8, 2
create animated sprite 2, "arno.bmp", 8, 8, 2
create animated sprite 3, "arno.bmp", 8, 8, 3
create animated sprite 4, "arno.bmp", 8, 8, 4
create animated sprite 5, "arno.bmp", 8, 8, 5
create animated sprite 6, "arno.bmp", 8, 8, 6
create animated sprite 7, "arno.bmp", 8, 8, 7
create animated sprite 8, "arno.bmp", 8, 8, 8
create animated sprite 9, "stopped.bmp", 1, 1, 9
REM spider sprite
create animated sprite 11, "spider.bmp", 8, 8, 11
create animated sprite 12, "spider.bmp", 8, 8, 12
create animated sprite 13, "spider.bmp", 8, 8, 13
create animated sprite 14, "spider.bmp", 8, 8, 14
create animated sprite 15, "spider.bmp", 8, 8, 15
create animated sprite 16, "spider.bmp", 8, 8, 16
create animated sprite 17, "spider.bmp", 8, 8, 17
create animated sprite 18, "spider.bmp", 8, 8, 18
REM LOAD BACKGROUND
Load bitmap "bg.bmp", 10
REM PRE MAIN
set current bitmap 0
REM this value helps negotiate the value for arno's play sprite
n=1
REM this value helps negotiate the value for spider's play sprite
`p=11
REM MAIN LOOP
disable escapekey : while escapekey()=0
REMSTART
This is where I am haveing trouble, with arno sprite. I have difenied the tile sheet above that has arno
doing animated up, down, left, right, and diagonal. If you hit the left arrow key it shows a sprite of
arno running left and the sprite moves left, at least that's what I want to happen. What is happening is
that only sprite number 1 plays but I can move it up, down, left, right.
REMEND
REM PLAYER CONTROLS
REM up, down, left, right movemeant
if scancode()=200 then y=y-5: play sprite 3, 1, 8, 50: n=3
if scancode()=208 then y=y+5: play sprite 4, 1, 8, 50: n=4
if scancode()=205 then x=x+5: play sprite 1, 1, 8, 50: n=1
if scancode()=203 then x=x-5: play sprite 2, 1, 8, 50: n=2
REM sprite for arno standing still
if scancode()=0 then play sprite 9, 1, 1, 50 : n=9:
REM DIAGONAL MOVEMEANT
`up and right
if scancode()=200 and scancode()=205 then y=y-5 and x=x+5: play sprite 7, 1, 8, 50: n=7
`up and left
if scancode()=200 and scancode()=203 then y=y-5 and x=x-5: play sprite 8, 1, 8, 50: n=8
`down and right
if scancode()=208 and scancode()=205 then y=y+5 and x=x+5: play sprite 6, 1, 8, 50: n=6
`down and left
if scancode()=208 and scancode()=203 then y=y+5 and x=x-5: play sprite 5, 1, 8, 50: n=5
REM UPDATE SPRITE
REM copy's BG.bmp to current background
copy bitmap 10, 0
`update the sprite frame each time thru the loop
REM play arno sprite
play sprite 9, 1, 1, 50
`draw the current sprite frame at X,Y
paste sprite n, x, y
REMSTART
I am trying to get the spider to move a little distance either left to right or up and down.
REMEND
move sprite 11, 10
REM play spider sprite
play sprite 11, 1, 8, 50:
`draw the current sprite frame at X,Y
paste sprite 11, 200, 300
REM sprite collision
REMSTART
if sprite hit(1, 11) then spritecolide=1
if sprite hit(2, 11) then spritecolide=2
if sprite hit(3, 11) then spritecolide=3
if sprite hit(4, 11) then spritecolide=4
if sprite hit(5, 11) then spritecolide=5
if sprite hit(6, 11) then spritecolide=6
if sprite hit(7, 11) then spritecolide=7
if sprite hit(9, 11) then spritecolide=9
if sprite hit(1, 15) then spritecolide=10
if sprite hit(2, 15) then spritecolide=11
if sprite hit(3, 15) then spritecolide=12
if sprite hit(4, 15) then spritecolide=13
if sprite hit(5, 15) then spritecolide=14
if sprite hit(6, 15) then spritecolide=15
if sprite hit(7, 15) then spritecolide=16
if sprite hit(9, 15) then spritecolide=17
if spritecolide=1-17 then print "GAME OVER": exit
REMEND
text 1,1,STR$(screen fps())
REM END MAIN LOOP
fastsync : endwhile
REM CLEANUP
for i = 1 to 100
if sprite exist(i)=1
delete sprite i
endif
next i
REM END GAME
end
FNG