playMaker

Author Topic: Checker game tutorial  (Read 1096 times)

mgervais

  • Playmaker Newbie
  • *
  • Posts: 21
Checker game tutorial
« on: September 05, 2020, 11:43:22 AM »
Hi everyone,

I wonder if anyone could lead me to a checker game tutorial or any board turn based game for that matter.

Essentially I need to use playmaker to:
1- Create a grid associated with an array
2- Populate each cell of the grid with a random sprite
3- Move a character sprite from one cell of the grid to another

Any help would be greatly appreciated

Mike

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Checker game tutorial
« Reply #1 on: September 06, 2020, 04:47:12 AM »
Hi.
Array Maker Has a Grid based array call Array List Table, but i have not yet used that myself.

but i did use multiple arrays on a Tetris game and array maker is best for this as it uses References.

I set up me game so that each grid position is 1 unity.

so the top left would be 0,0 (the reason i start with 0,0 and not 1,1 is that an array start with 0,0 as well)

This way can can get a position and then used the x position as a reference for which array i need to look.. and i used y position as the index of that array.

in my case i needed to know if a location was occupied and also a which color it has.
So i used int variables in the list to know what color to set and to know if it was empty or not (0 would be empty, 1 yellow 2 red, etc)

for movement you can do in different ways.
mainly you 1st want to know if some grid items should block movement.

When player moves to a direction you could look in the array list which object it is or if your player will be out of bound.
and with the result you can move or not move to that location.

mgervais

  • Playmaker Newbie
  • *
  • Posts: 21
Re: Checker game tutorial
« Reply #2 on: September 07, 2020, 11:07:20 AM »
Ok, Here's a question. True or false.

If I want to make a grid filled with random colored cubes using Playmaker. I would need 3 arrays. One for the X position of my grid, another for the Y position, and third one to shuffle a color to apply to each cube I would place on the grid.

Then I would use CreateGameObject Cube, X,Y, color. And loop it untill the gris is fully filled.

(Note: The last sentence is not playmaker commands but just the logic of how things would work)

Mike

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Checker game tutorial
« Reply #3 on: September 07, 2020, 03:15:42 PM »
Hi.
You can have 1 array (vector 3) to set a list of positions to spawn the cubes.
and 1 array with a list of colors (or use "Select Random Color' Action)

But do you need to do more than that?


For a grid you would need as many arrays as you need to do vertical.

for example if your grid would be 4x4 you would need 4 arrays.

The reference of these arrays should be 0,1,2,3 and the size from each array should be 4 (item 3)

mgervais

  • Playmaker Newbie
  • *
  • Posts: 21
Re: Checker game tutorial
« Reply #4 on: September 11, 2020, 07:20:50 AM »
Hi djaydino.

Thank you so much for your advice. It helps a lot. Just the challenge of creating a nice colorful grid in a turn based grid is a project by itself. Just think of Polytopia.

I didn't know that there were vertor 3 array types though. That really helps.

Thanks again.