Snakes and ladders game

Creating Games? Developing something for fun?

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

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

Snakes and ladders game

Post by NRobb2 » Sun Jan 04, 2015 9:48 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 :D

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

Re: Snakes and ladders game

Post by SparkOut » Sun Jan 04, 2015 10:16 pm

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

Post by NRobb2 » Sun Jan 04, 2015 10:21 pm

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

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

Re: Snakes and ladders game

Post by SparkOut » Sun Jan 04, 2015 10:36 pm

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

Post by NRobb2 » Tue Jan 06, 2015 2:12 pm

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

Post by newtronsols » Tue Jan 06, 2015 4:14 pm

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 = :D

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... :mrgreen:

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

Re: Snakes and ladders game

Post by SparkOut » Tue Jan 06, 2015 5:32 pm

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

Post by NRobb2 » Wed Jan 07, 2015 1:50 pm

Wow thanks for all the ides guys :D 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

Post by NRobb2 » Wed Jan 07, 2015 3:12 pm

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 :D 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?? :oops:

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

Re: Snakes and ladders game

Post by Mokima » Wed Jan 07, 2015 4:22 pm

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

Post by NRobb2 » Sat Jan 17, 2015 9:29 pm

Thank you very much :D I know think I know what I am doing :oops:

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

Re: Snakes and ladders game

Post by NRobb2 » Sun Jan 25, 2015 11:07 am

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

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

Re: Snakes and ladders game

Post by SparkOut » Sun Jan 25, 2015 11:15 am

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

Post by NRobb2 » Sun Jan 25, 2015 11:36 am

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: 10097
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Snakes and ladders game

Post by Klaus » Sun Jan 25, 2015 11:49 am

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! :D


Best

Klaus

Post Reply

Return to “Creating Games”