VideoHive

Tetris

723 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Netherlands
  • Referred between 50 and 99 users
  • Sold between 10 000 and 50 000 dollars
BigZ says

I was wondering…would it be hard to create Tetris in flash? If anyone has any good suggestions, I might give it a try.

4247 posts
  • Attended a Community Meetup
  • Bought between 10 and 49 items
  • Contributed a Blog Post
  • Exclusive Author
  • Has been a member for 4-5 years
  • Sold between 10 000 and 50 000 dollars
  • United States
Aw_Shucks says

I’d think if you can figure out how to control the pieces it wouldn’t be such a hard task doing the rest. You’d probably have to figure a way to randomly add pieces at durations based on how long it takes for the piece to be set in its final placement. To control the increased speed at which the pieces fall, you could set a timer on a keyboard key (like the down key) to see if the user is pressing the key down for a certain length of time. If you can perceive it, you can create it. Think of the possibilities.

EDIT

Oh, if you use a Tweening class that has an attribute like Tweener has “onComplete”, you could initiate specific functionalities when a piece is finished animating. It’s an idea.

2988 posts
  • Community Superstar
  • Has been a member for 5-6 years
  • Won a Competition
  • Sold between 50 000 and 100 000 dollars
  • Bought between 10 and 49 items
  • Referred between 50 and 99 users
  • Europe
+1 more
wickedpixel says

Something like this?

723 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Netherlands
  • Referred between 50 and 99 users
  • Sold between 10 000 and 50 000 dollars
BigZ says

I think the hardest part is how to read when there is a full line and how pieces fit into eachother.

1173 posts
  • Australia
  • Beta Tester
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Sold between 10 000 and 50 000 dollars
Motionreactor says

If you are asking if it would be hard, then it means you probably are not sure of how to implement it at all. So yes, it will be difficult. Do heaps of research, you will find tutorials on creating tetris with other languages… such as C, C++, Java, JavaScript. This will give you a clearer picture of the architecture required. It is the logic of the game that will probably be most unclear to you atm, the implementation should be fairly clear if you already have a good grasp of ActionScript.

723 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Netherlands
  • Referred between 50 and 99 users
  • Sold between 10 000 and 50 000 dollars
BigZ says
Something like this?

Basically yes, only smaller. Does yours read out when there is a line?

1173 posts
  • Australia
  • Beta Tester
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Sold between 10 000 and 50 000 dollars
Motionreactor says
I think the hardest part is how to read when there is a full line and how pieces fit into eachother.

I thought about this briefly and I think one solution would be to use a 2D Array… you can check with some logic whether rows are full and be able to increment block positions too. Essentially it is a grid ‘playing field’ so a 2D Array is useful in this sense.

2988 posts
  • Community Superstar
  • Has been a member for 5-6 years
  • Won a Competition
  • Sold between 50 000 and 100 000 dollars
  • Bought between 10 and 49 items
  • Referred between 50 and 99 users
  • Europe
+1 more
wickedpixel says
I think the hardest part is how to read when there is a full line and how pieces fit into eachother.

I think the fit thing is pretty easy… after a block hits the floor you must break it apart so every square from it will be a piece of the big-ass matrix that you must test for full lines…


@BigZ that one is not made by me :) ... i thought is a funny example… i have made one line in 15 minutes :)

723 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Netherlands
  • Referred between 50 and 99 users
  • Sold between 10 000 and 50 000 dollars
BigZ says

I have thought about the matrix too, I think it’s the best option to start with.

4247 posts
  • Attended a Community Meetup
  • Bought between 10 and 49 items
  • Contributed a Blog Post
  • Exclusive Author
  • Has been a member for 4-5 years
  • Sold between 10 000 and 50 000 dollars
  • United States
Aw_Shucks says

Its probably not the best idea, but here’s what I thought of to check for full lines.

Store the area’s width and height in which 1 block will fit for every block vertically and for every block horizontally. When a piece drops initiate an EnterFrame that checks for an array of blocks filled all the way across horizontally based on the values stored in those variables. If any of the areas filled horizontally across match the arrays in which parts of the variable’s values are stored, initiate a function that deletes those blocks. Then delete the on EnterFrame, and start again.

by
by
by
by
by