Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / sprite movement ,help needed please

Author
Message
Ashley Decorator
19
Years of Service
User Offline
Joined: 27th Jan 2005
Location:
Posted: 28th Jan 2005 04:19
hi,

basicly i have started to write a monopoly game, have drawn the board in paintshop and is 660x660

for testing sprite movement i have used up/down/left/right and the sprite moves perfectly from square to square by changing the xpos/ypos by either +66 or -66 (66 being one move)

but in order to get my dice making the moves i need some code to make the sprite move around the board and not go off the screen.

i tried to do this by just using the leftkey() to simulate the dice moves and managed to get the sprite from 'go' to 'just visiting' and to 'free parking' using the code below.

but cant seem to make the sprite continue around the board back to 'go'

have been trying now for the last two nights so any help would be great.

xpos=660
ypos=660

do

if leftkey()=1 then xpos=xpos-66

this line below makes my sprite continue up the board to 'free parking'

if xpos=<-10 and ypos=<660 then ypos=ypos-66:xpos=0

but i have tried different variations of above line and nothing works

board layout below if it helps you to help me

top left (xpos=0/ypos=0)
top right (xpos=660/ypos=0)
bottom left (xpos=0/ypos=660)
bottom right (xpos=660/ypos=660)

thanks

ash
Mr Pointless
20
Years of Service
User Offline
Joined: 17th Oct 2004
Location: Stuck in the UK
Posted: 29th Jan 2005 04:33
Have you tried this?

if xpos=<-10 and ypos=<660
ypos=ypos-66
xpos=0
endif

Or, if that doesn't work:

if xpos=<-10
if ypos=<660
ypos=ypos-66
xpos=0
endif
endif



Originality is not dead, it just has an annoying tendency to fall asleep without setting the alarm clock

Login to post a reply

Server time is: 2024-11-27 20:38:10
Your offset time is: 2024-11-27 20:38:10