playMaker

Author Topic: Tetris for tutorial  (Read 1056 times)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 2254
    • View Profile
    • jinxtergames
Tetris for tutorial
« on: June 13, 2016, 09:52:29 AM »
Hi,
i made a Tetris game for playmaker tutorial purpose and i placed it on my website for testing.
Try it out and if you find some bugs please let me know.

I will release a documented package on my website in a couple of days when i think most bugs are gone.

And i will make a video tutorial about it :)

you can check it out here (best played in firefox) :





4ppleseed

  • Full Member
  • ***
  • Posts: 227
    • View Profile
Re: Tetris for tutorial
« Reply #1 on: April 25, 2017, 05:26:37 AM »
Hi djaydino, did you get around to making the video/tutorial? Does this use Arrays? I'd love to see it if you have it :D

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 2254
    • View Profile
    • jinxtergames
Re: Tetris for tutorial
« Reply #2 on: April 25, 2017, 06:38:04 AM »
Hi,
The sample is on my website, but i don't have a tutorial video yet.
Way to much work and other pending stuff :(

The sample uses arrays yes.

4ppleseed

  • Full Member
  • ***
  • Posts: 227
    • View Profile
Re: Tetris for tutorial
« Reply #3 on: April 25, 2017, 11:25:51 AM »
No probs! I'll check out the sample - thanks  8)

This uses ArrayMaker, right? Would it be hard for me to convert this to Playmaker native arrays?
« Last Edit: April 25, 2017, 11:30:37 AM by 4ppleseed »

4ppleseed

  • Full Member
  • ***
  • Posts: 227
    • View Profile
Re: Tetris for tutorial
« Reply #4 on: August 20, 2017, 01:34:35 PM »
Would love a tutorial on this as I'm not really understanding how the basic Array stuff is working.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 2254
    • View Profile
    • jinxtergames
Re: Tetris for tutorial
« Reply #5 on: August 20, 2017, 09:31:54 PM »
Hi,
What are you trying to achieve, maybe i can run you thru it or make a sample

in the tetris game it works like a raster

Each array represents a line, when i drop a piece, i will  split it to single blocks,
and place them into the array for each line

after that i check how many objects are in the array lines, if there are 10 item (full Line)
i will do some actions to remove the line(clear the array) and then place the above line(array) into that array then test next line and do the same

4ppleseed

  • Full Member
  • ***
  • Posts: 227
    • View Profile
Re: Tetris for tutorial
« Reply #6 on: August 22, 2017, 12:55:20 AM »
I was just trying to track GameObject position in an array and then check if there are three (or more) in a row, horizontally, vertically and diagonally and then using the Array reference - delete those matching Game Objects. Just simple Match Three style stuff really.

Lets say one block at a time falls down into a 4x4 grid and when we press a button they freeze and lock into a grid.

So the first block falls and we move it into the bottom left position: A1

OOOO ROW C
OOOO ROW B
XOOO ROW A

1234

Then two more fall and we lock them into B2 and C3, creating a diagonal three:

OOXO ROW C
OXOO ROW B
XOOO ROW A

1234

So, what I want to do is:

Add that these three game objects are in their positions to the Array as each one happens.

Check if there are three in a row after each one is in position.

Then delete the three gameobjects using the Array position data.

Does that make sense?  8)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 2254
    • View Profile
    • jinxtergames
Re: Tetris for tutorial
« Reply #7 on: August 22, 2017, 05:52:02 PM »
Yes,
Similar to a match 3 game

i am actually working on a match 3 tutorial, but i have a lot of work the next few days.
After that i will prioritize the match 3 tutorial.


basically you will need an int array for each row
i use int number for color coding/gem matching, so for example int 1 would be yellow gem, 2 green gem, and so on. 0 would be empty.

after a drop you need to place the new dropped item it to the designated array which can be done in different ways.

A good thing is to build your grid so that x1y1 would be position A1
the next position would be x2y1 for A2 and so on.

then loop thru the arrays and compare a1 a2 and so on and if you have 3 int's or more next to each other you have a match, that you can store then to destroy after vertical and diagonal has been check also

To do this, it is best to use array maker and not the standard arrays.

because for vertical and diagonal i would use an "Itereate" build a string and use that string to reference the needed arrays and that is a lot harder to do with the standard arrays.

4ppleseed

  • Full Member
  • ***
  • Posts: 227
    • View Profile
Re: Tetris for tutorial
« Reply #8 on: August 23, 2017, 12:42:17 AM »
Yep, a Match Three tutorial would be great  :D

I now understand all of the above except how to do one thing. Using the Array data how do I GET the object at position A1 to be able to delete it?

I know there is an object there as it has flagged A1 in the array (I guess using a collision trigger to set the INT to a number greater than 0?) but at the 'delete all matching rows/columns stage' - what's the best way to get the object at position A1 to be able to delete it?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 2254
    • View Profile
    • jinxtergames
Re: Tetris for tutorial
« Reply #9 on: August 23, 2017, 08:31:58 AM »
Hi,
With some more arrays :D

again for each row,
what you can do for example is to get the position of the dropped item
then set x and y as int and use x for the index (if you use an array for horizontal)
and y to build a string to get the row. and set the object in the string.