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.

2D All the way! / help needed moving sprite around monopoly board, please

Author
Message
Ashley Decorator
21
Years of Service
User Offline
Joined: 27th Jan 2005
Location:
Posted: 28th Jan 2005 05:41
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
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 28th Jan 2005 06:31 Edited at: 28th Jan 2005 06:32
I think this should work...


if xpos < 67 and ypos >67 then ypos=ypos-66

if xpos < 660 and ypos < 67 then xpos=xpos+66

if xpos > 593 and ypos < 67 then ypos=ypos+66

if xpos > 593 and ypos > 593 then xpos=xpos-66

Ashley Decorator
21
Years of Service
User Offline
Joined: 27th Jan 2005
Location:
Posted: 28th Jan 2005 23:42
Hello again,

still can't get sprite moving right, but code you gave me almost worked, prob just need tweaking somewhere else.

so if you have a bit of spare time, would you mind having a run through it. have enclosed the code written so far plus board and player sprite media.

(had to zip board and sprites as could only select one attachment, but have virus checked it first)

thanks again, shall be ok with rest of game (i think) just really stuck at moment and cant take game any further

Login to post a reply

Server time is: 2026-06-11 17:32:53
Your offset time is: 2026-06-11 17:32:53