im making a 2d rpg but thier is something wrong with positioning the main sprite. i set the sprite with 'sprite 1,200,50,1 which it does but later i had to add the code 1,x,y,1 to update the movement problem is it bypasses the position i set at the beggining is thier a altewrnative to this? the source is included
sync on
sync rate 60
Set Display Mode 1024,768,16
dim map(10,10)
for y=0 to 9
for x=0 to 9
read mapdata
map(x,y)=mapdata
next x
next y
ink rgb(244,214,210),1
load image "grass08.bmp",3
load bitmap "shop.bmp",4
get image 4,0,0,86,77
sprite 2,300,400,4
load bitmap "shopdoor.bmp",5
get image 5,0,0,29,28
sprite 3,333,449,5
load bitmap "idle.bmp",1
get image 1,0,0,29,68
sprite 1,200,50,1
scale sprite 1,75
for y=0 to 9
for x=0 to 9
objnum = objnum + 1
make object plain objnum,10,10
position object objnum,x*10,y*10,75
if map(x,y)> 0 then texture object objnum,map(x,y) else color object objnum,0
next x
next y
rem Press left mouse button to quit
do
main:
rem Clear screen
rem Record old position
oldx=x
oldy=y
rem Control position with cursors
if upkey()=1 then y=y-13
if downkey()=1 then y=y+13
if leftkey()=1 then x=x-13
if rightkey()=1 then x=x+13
rem draw the sprite at the new position
`sprite 1,200,200,1
sprite 1,x,y,1
rem Check for collision and block new position
if sprite collision(1,2)>0
x=oldx
y=oldy
sprite 1,x,y,1
endif
if sprite hit(1,3)>0
x=oldx
y=oldy
sprite 1,x,y,1
goto shop
endif
` X,Y,ZOOM
position camera 45,45,-10
xrotate camera 0.0
yrotate camera angle#
zrotate camera 0.0
rem Update screen
sync
loop
`data for map
data 3,3,3,3,3,3,3,3,3,3
data 3,3,3,3,3,3,3,3,3,3
data 3,3,3,3,3,3,3,3,3,3
data 3,3,3,3,3,3,3,3,3,3
data 3,3,3,3,3,3,3,3,3,3
data 3,3,3,3,3,3,3,3,3,3
data 3,3,3,3,3,3,3,3,3,3
data 3,3,3,3,3,3,3,3,3,3
data 3,3,3,3,3,3,3,3,3,3
data 3,3,3,3,3,3,3,3,3,3
shop:
delete sprite 2
delete sprite 3
cls
dim map(10,10)
for y=0 to 9
for x=0 to 9
read mapdata
map(x,y)=mapdata
next x
next y
ink rgb(244,214,210),1
load bitmap "idle.bmp",1
get image 1,0,0,29,68
scale sprite 1,90
mirror sprite 1
sprite 4,270,50,1
scale sprite 4,90
load image "ash01.bmp",3
load bitmap "itemcounter.bmp",10
get image 10,0,0,166,76
sprite 5,210,85,10
sprite 1,100,100,1
for y=0 to 9
for x=0 to 9
objnum = objnum + 1
make object plain objnum,10,10
position object objnum,x*10,y*10,75
if map(x,y)> 0 then texture object objnum,map(x,y) else color object objnum,0
next x
next y
rem Press left mouse button to quit
do
rem Clear screen
rem Record old position
oldx=x
oldy=y
rem Control position with cursors
if upkey()=1 then y=y-13
if downkey()=1 then y=y+13
if leftkey()=1 then x=x-13
if rightkey()=1 then x=x+13
rem draw the sprite at the new position
sprite 1,x,y,1
`if sprite hit(1,5)>0 then goto talk:
` X,Y,ZOOM
position camera 45,45,-10
xrotate camera 0.0
yrotate camera angle#
zrotate camera 0.0
rem Update screen
sync
loop
data 3,3,3,3,3,3,3,3,3,3
data 3,3,3,3,3,3,3,3,3,3
data 3,3,3,3,3,3,3,3,3,3
data 3,3,3,3,3,3,3,3,3,3
data 3,3,3,3,3,3,3,3,3,3
data 3,3,3,3,3,3,3,3,3,3
data 3,3,3,3,3,3,3,3,3,3
data 3,3,3,3,3,3,3,3,3,3
data 3,3,3,3,3,3,3,3,3,3
data 3,3,3,3,3,3,3,3,3,3
`talk:
`ink rgb(0,0,0),0
`box 0,0,100,100
Daedalus