Creating Games? Developing something for fun?

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

NRobb2
Posts: 15
Joined: Sun Jan 04, 2015 9:40 pm

Hi guys,
I'm currently in 5th year at school and doing advanced higher computing. For our project we have had to create a game, mines being snakes and ladders. I'm fine with getting the dice roll and stuff, but i am getting stuck with how to create the board/snakes/ladders and how to program it all together. I'm aware that live code is not available to use animation so it will appear 'jumpy'. Oh and i need to include a local high-score table. Any advice would be muchly appreciated

SparkOut
Posts: 1870
Joined: Sun Sep 23, 2007 4:58 pm

### Re: Snakes and ladders game

Firstly, you can do animations with LiveCode, but we needn't worry about that until the mechanics are sorted out.

Snakes and ladders is generally a 10 x 10 square, so you can have a two dimensional coordinate for your location. Add the dice roll to the x coordinate and if it goes past 10, then add 1 to the y coordinate and start subtracting the remainder from the x coordinate, to reverse the direction across the board. Switch direction again if the value of x becomes less than one. Check the end coordinates against your known snake or ladder squares and change position if need be.
Repeat with each player until someone reaches square 1,10. (Square 100 is at the "start" side of the board.)

You will need some basic maths, an understanding of two dimensional coordinates and will have a lot of fun.

NRobb2
Posts: 15
Joined: Sun Jan 04, 2015 9:40 pm

### Re: Snakes and ladders game

Thanks for the quick response. So how would you suggest i create the actual board??

SparkOut
Posts: 1870
Joined: Sun Sep 23, 2007 4:58 pm

### Re: Snakes and ladders game

Lots of ways. An image. Or a group of rectangle graphics. The only thing you need to ensure is that you have a way of mapping the coordinates of the squares with the pixel coordinates of the centre of the square on screen. If it's a fixed size then a simple multiplication would do, if you know the number of pixels in the regular gap between the centre of one square and the next.

Oh, by the way, how can you have a high score table for snakes & ladders?

NRobb2
Posts: 15
Joined: Sun Jan 04, 2015 9:40 pm

### Re: Snakes and ladders game

the high score table was going to be done on the number of moves made within the game for a player, ie, for each dice roll the players score will increase by 1. The lower the final score the better. I know its not the best but some form of file handling had to be included.

newtronsols
Posts: 192
Joined: Tue Mar 11, 2014 12:57 pm

### Re: Snakes and ladders game

You could do it differently - no dice - allow 6 seconds to add 2 random numbers [hence add'ers name later]. Answer in 1 second = throw a 6. etc. Fail to answer = lose a turn. So not entirely random whether you succeed and teacher =

You could also do it like a very old game [star chess - http://www.old-computers.com/museum/com ... =1116&st=2] where you warp off with 'sound' - disappear, reappear with sound. Saves a bit on diagonal animation of a snake up a ladder. So in the game you warp/move your 'star snake' from one galaxy to another or land in a black hole.

Could be called "star snakes and add'ers". .. you're supposed to laugh now...

SparkOut
Posts: 1870
Joined: Sun Sep 23, 2007 4:58 pm

### Re: Snakes and ladders game

Well, I'm smiling.
But when it comes to animation I was waiting to blow Rob's mind (it is Rob,isn't it?) with how easy it would be to move the player to the points of a hidden line graphic which follows the wiggly shape of the visible snake.

NRobb2
Posts: 15
Joined: Sun Jan 04, 2015 9:40 pm

### Re: Snakes and ladders game

Wow thanks for all the ides guys I think I do recall animation now, you draw a line and set the image to follow it right?? or something like that! I do like the idea of the questions being involved as well, might add that in if I have enough time at the end!

NRobb2
Posts: 15
Joined: Sun Jan 04, 2015 9:40 pm

### Re: Snakes and ladders game

I am really stuck with the creation of this board any ideas that would be easy(to an extent) for me to use would be greatly appreciated also I know I am probably being stupid, but how do i have variables available throughout the whole program and not just within one button??

Mokima
Posts: 10
Joined: Tue Dec 30, 2014 8:08 pm

### Re: Snakes and ladders game

For the variables, all you need to do is make them global. So if you're using your card script, at the top put 'Global' followed by the variable(or variables) you want to make global. To use them within buttons, make sure you declare them global in both the card and the button scripts, and if using multiple variables this way, put a comma between them to separate them.

NRobb2
Posts: 15
Joined: Sun Jan 04, 2015 9:40 pm

### Re: Snakes and ladders game

Thank you very much I know think I know what I am doing

NRobb2
Posts: 15
Joined: Sun Jan 04, 2015 9:40 pm

### Re: Snakes and ladders game

will I be able to use a 2D array to create my board in snakes and ladders??

SparkOut
Posts: 1870
Joined: Sun Sep 23, 2007 4:58 pm

### Re: Snakes and ladders game

One word: yes.
More words: yes that will work as one possible structure to reference the board spaces.
The really long answer depends on various conceptual ideas you have about how to create the game, so we have no way of giving any more detail.

NRobb2
Posts: 15
Joined: Sun Jan 04, 2015 9:40 pm

### Re: Snakes and ladders game

Basically I have created the board currently by using lots of image fields, and setting their location 1 by 1 in the code. However, I need to have used a 2D array somewhere in my project for it to be at Advanced Higher, and we have not yet been taught 2D arrays so I have very little ideas as to where this could be included within snakes and ladders.

Klaus
Posts: 10755
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

### Re: Snakes and ladders game

Hi Robb,

call me PICKY, but please get used to the correct terminology to avoid misunderstandings in the future!
NRobb2 wrote:...lots of image fields,
There are FIELD objects and IMAGE objects, but no image fields!

Best

Klaus