Panduan pemula menggunakan Construct 2 (Bagian 2)

Menambahkan layer

Ok, sekarang kita akan menambahkan beberapa objek lagi. Sementara itu, untuk mencegah kejadian salah klik objek pada 'tiled background' dapatmenguncinya, sehingga objek tersebut tidak dapat diseleksi lagi. Mari kita gunakan 'layering system' untuk hal ini.
Sebuah Layout dapat terdiri dari beberapa layer, di mana anda dapat menggunakannya untuk mengelompokkan objek-objek. Bayangkan sebuah layer itu seperti sebuah kaca yang ditumpuk satu sama lain, dengan objek tergambar di setiap bagian kaca tersebut. Hal ini juga membuat anda mudah untuk menampilakan objek di atas objek lainnya, dan layer dapat juga dikunci, disembunyikan, menggunakan efek parallax, dan banyak lagi. Sebagai contoh, dalam game ini, kita ingin semua objek ditampilkan di atas tiled background, oleh karena itu kita perlu menambahkan layer di atas nya sebagai layer tempat penampungan objek-objek baru tersebut.
Untuk mengatur layer, klik Layers tab, tepat di samping Project bar:
Layers bar tab
Anda akan melihat Layer 0 pada list (Hitungan dalam Construct 2 dimulai dari angka nol, dimana hal tersebut biasa diterapkan pada bahasa pemrograman). Klik ikon pensil dan ganti nama menjadi Background, karena ini adalah layer untuk background game kita. Lalu klik ikon hijau 'add' untuk menambah layer baru yang akan menampung objek lainnya yang akan kita masukkan. Kita bisa sebut Main. Akhirnya, jika anda mengklik ikon 'padlock' di samping Background, layer ini akan menjadi terkunci. Itu berarti anda tidak akan bisa mengklik apapun objek dari layer ini. Menjadi sangat berguna untuk tiled background kita, dimana objek ini mudah sekali diklik secara tidak sengaja. Akan tetapi, jika anda ingin merubahnya, cukup dengan mengklik ikon 'padlock' lagi untuk membuka kuncinya.
Checkboxes juga membantu anda untuk menyembunyikan layer pada editor, tetapi kita tidak perlu melakukan itu sekarang. Sekarang layer bar anda seharusnya tampak seperti berikut:
The layers bar, all set up.
*Proses translasi ke bahasa Indonesia baru sampai di sini, translator akan berusaha menyelesaikannya dalam waktu dekat.
Now, make sure the 'Main' layer is selected in the layers bar. This is important - the selected layer is the active layer. All new inserted objects are inserted to theactive layer, so if it's not selected, we'll be accidentally inserting to the wrong layer. The active layer is shown in the status bar, and also appears in a tooltip when placing a new object - it's worth keeping an eye on.

Add the input objects

Turn your attention back to the layout. Double click to insert another new object. This time, select the Mouse object, since we'll need mouse input. Do the same again for the Keyboard object.
Note: these objects don't need placing in a layout. They are hidden, and automatically work project-wide. Now all layouts in our project can accept mouse and keyboard input.

The game objects

It's time to insert our game objects! Here are your textures - save them all to disk like before.
Player:
Player texture
Monster:
Monster texture
Bullet:
Bullet texture
and Explosion:
Explosion texture
For each of these objects, we will be using a sprite object. It simply displays a texture, which you can move about, rotate and resize. Games are generally composed mostly out of sprite objects. Let's insert each of the above four objects as sprite objects. The process is similar to inserting the Tiled Background:
1. Double click to insert a new object
2. Double click the 'Sprite' object.
3. When the mouse turns to a crosshair, click somewhere in the layout. The tooltip should be 'Main'. (Remember this is the active layout.)
4. The texture editor pops up. Click the open icon, and load one of the four textures.
5. Close the texture editor, saving your changes. You should now see the object in the layout!
Note: another quick way to insert sprite objects is to drag and drop the image file from Windows in to the layout area. Construct 2 will create a Sprite with that texture for you. Be sure to drag each image in one at a time though - if you drag all four in at once, Construct 2 will make a single sprite with four animation frames.
Move the bullet and explosion sprites to somewhere off the edge of the layout - we don't want to see them when the game starts.
These objects will be called SpriteSprite2Sprite3 and Sprite4. That's not very useful - things will quickly get confusing like this. Rename them to Player,MonsterBullet and Explosion as appropriate. You can do it by selecting the object, then changing the Name property in the properties bar:
Renaming an object.

1 komentar:

  1. mantap itu infonya ...., kunjungi juga blog ane gan http://winkawak1.blogspot.co.id/2017/01/cara-membuat-game-android-dengan.html

    BalasHapus

Copyright © 2012 Nugasoft Production.