Tutorial Downloads

File Size
blockit.capx235KB

Translations

Know another language? Translate this tutorial!

Stats

590 visitors
904 page views

Block it Game (under 10 events)

Favourite 4 favourites
Tutorial written by gamecorpstudioOriginally published on 23rd, November 2016 - 1 revision

Hi, wanted to show for those who dont know C2 very well yet, how they can make a Block It Type of game under 10 events.

What we will need :

1 sprite object for the ball;

2 local variables on the sprite object (score,hiscore)

2 tiled background objects;

Touch plugin;

LocalStorage;

And 1 text or 2 depends how much info you want to display, i used 2 sprite fonts in my example. (we will use 2 sprite fonts, for score and hiscore indication)

Let's begin:

First we create a new Landscape, or Portrait project, i choose'd a Portrait one since the game is minimalist by itself and doesn't require to much graphics or info on sides.

The we add the sprite object create a frame that represents a circle or a dot around the size of 32 x 32 px choose any color, myself i choose'd to design the game in a monochrome pallet (B&W).

Then we add the 2 tiled backgrounds, and set their frame or image to 32x32 and what color you want.

Lets explain why 2 tiled backgrounds: 1st one will use it as walls, the 2nd one will use it as the show/hide ball deflector as i like to call it.

Once we placed them in the screen editor like in the following image:
We add the behavior solid to the Tiled Backgrounds, and for the ball sprite object, we add the behavior bullet and set the bullet option bounce out of solids to Yes.

We also make the Deflector invisible by default from the bottom settings page in left side, and Disable the Solid Behavior, so its not going to glitch on start of layout.

Lets move to the event sheet:


Ok so lets explain things a bit, on start of layout we give the ball a push, the push itself since the ball has the bullet behavior, it automatically moves towards the angle direction the ball has, so we change that to a random(230,320) that will push on start of layout the ball towards the angle left 45 degress upwards to 45 degrees right upwards.

now we call the localstorage i know its a bit confusing but bare with me all will be explain, so at beginning of layout the localstorage calls the value of hiscore and sets the value to the ball.hiscore if the ball.hiscore is equal to 0 or less then 0.

as we see next line when the ball hits the deflector, ads 1 to score and sets the 1st spritefont the big one in the middle, and then we compare if score is greater then hiscore, then hiscore is set to the value of score.

once the hiscore is saved in the ball.hiscore variable, we save that info into the localstorage then we added the wait 0 to make sure that localstorage made that action. once that happened we call the get item hiscore and set it to the spritefont from the top which is the hiscore indicator.

Kinda that is it... and its only in 6 events... and you have another 94 events to customize it as you like, if your using the C2 free edition.

You can find the final capx in the attachments. Feel free to ask a tutorial and comment/rate/share this tutorial. Hope you found it helpful and fun.

You can also play the gamehere. For some reasons the Scirra Arcade doesn't read the localstorage value for hiscore, maybe is because i used spritefont. But all works well on localhost:preview.

Unlock your full gamedev potential

Upgrade to the Personal Edition of Construct 2, it has way more features and won't holding back from making money and using your full creativity like the free edition does. It's a one off payment and all Construct 2 editor updates are free for life!

View deals

Plus, it's got a lot of additional features that will help you save time and make more impressive games!

Congratulations on finishing this tutorial!

Did you learn a lot from it? Share it now with your friends!

Share and Copy this Tutorial

You are free to copy, distribute, transmit and adapt this work with correct attribution. Click for more info.

Comments

1
planetacolision 3,102 rep

Nice job!!!

Tuesday, November 29, 2016 at 12:45:48 AM
0
gamecorpstudio 43.3k rep
Nice job!!!
quoted from planetacolision

thanks

Saturday, December 10, 2016 at 7:42:05 AM
0
iceangel 32.5k rep

Thanks for sharing!

Saturday, December 17, 2016 at 7:06:30 AM

Leave a comment

Everyone is welcome to leave their thoughts! Register a new account or login.