# Need help with a monopoly-style game

### » Wed May 25, 2011 10:55 am

Hello!
I'm Lunar. I'm new to construct and I have no experience programming either . I'm working on a simple board game like monopoly. I've been doing a few tutorials but I couldn't find anything about board games.

I just want to make the players (sprites) move through the grid boxes in the board.

This is what I did:

First I gave each player the private variable 'Vmoves'

When the dice generate a random number between 1-6 'Vmoves' is set to that random number.

I created a sprite called 'grid' 50x50 pixels, and then duplicated it to make the board.

when player1: Value 'Vmoves' greater or equal than 1.
>player1 angle equal to 0. ---->>player1 setX to player1X +50
.................................... player1 setY to player1Y
>player1 angle equal to 90 --->>player1 setX to player1X
.................................... player1 setY to player1Y +50
>player1 angle equal to 180 --->>player1 setX to player1X -50
..................................... player1 setY to player1Y
>player1 angle equal to 270 --->>player1 setX to player1X
..................................... player1 setY to player1Y -50
Also when player1 overlaps the sprite 'grid' --->>subtract 1 from player1 private variable 'Vmoves'

And I repeated this for each player

For changing the Angles: when player overlaps the 'Sprite Arrow' the player gets his angle set to match the 'Sprite Arrow'

this way is a bit too long and I feel its not a good method.

Is there a way to make the player move by my 'grid Sprite' boxes intead of using pixels ?
I've been trying to make this work for a long time,
I hope someone could help me, any tip will be really appreciated.

Thank you!
B
1
G
1
Posts: 4
Reputation: 433

### » Wed May 25, 2011 11:34 am

hello lunar,

have you taken a look at the 'grid movement' behavior? it might have what you need...

http://sourceforge.net/apps/mediawiki/c ... d_Behavior

welcome to construct...i'm learning as i go as well. the wiki has a lot of useful information.

harrio...
B
81
S
32
G
23
Posts: 1,053
Reputation: 35,965

### » Wed May 25, 2011 12:14 pm

Thanks harrio !
I've just read that wiki page and I'm going to try with the 'grid movement 'behaviour. I'll post here my results

Btw, are there any tutorials about the 'grid movement' behaviour?
B
1
G
1
Posts: 4
Reputation: 433

### » Wed May 25, 2011 12:55 pm

[quote="Lunar":1ey30lkj]Btw, are there any tutorials about the 'grid movement' behaviour?[/quote:1ey30lkj]

i don't know off the top of my head. i would check out the tutorials thread...

[url:1ey30lkj]http://www.scirra.com/forum/viewforum.php?f=8[/url:1ey30lkj]

and/or do a search on grid movement threads in the forum. you might stumble across some good info.

hope that helps...

harrio...
B
81
S
32
G
23
Posts: 1,053
Reputation: 35,965

### » Wed May 25, 2011 1:15 pm

Thanks again harrio !
Actually, after playing a bit with the grid movement I just had an idea that solved all this!

player1 angle equal to 0. ---->>player1 setX to player1X +grid.Width

I feel embarrassed because now it seems so obvious

I hope this will help someone too. Maybe later I'll post here the finished .cap when I discover how to attach a .cap

Lunar
B
1
G
1
Posts: 4
Reputation: 433

### » Wed May 25, 2011 2:24 pm

no problem, i've been helped here, so i'm more than glad to return the favor.

for posting caps, i've noticed that it is the general practice of users here to post links from dropbox or sometimes even box.net. they are both free with more than enough free space. i use dropbox to post caps and html5 tests. it's pretty straightforward to setup. you should have no problems with it.

keep constructing...

harrio...
B
81
S
32
G
23
Posts: 1,053
Reputation: 35,965