Info Tentang Beginner's guide to Construct 2 (Bagian 6) Update Terbaru 2017 Gratis

Sedikit Info Seputar Beginner's guide to Construct 2 (Bagian 6) Terbaru 2017 - Hay gaes kali ini team Apps Android Games, kali ini akan membahas artikel dengan judul Beginner's guide to Construct 2 (Bagian 6), kami selaku Team Apps Android Games telah mempersiapkan artikel ini untuk sobat sobat yang menyukai Apps Android Games. semoga isi postingan tentang Artikel Construct 2, yang saya posting kali ini dapat dipahami dengan mudah serta memberi manfa'at bagi kalian semua, walaupun tidak sempurna setidaknya artikel kami memberi sedikit informasi kepada kalian semua. ok langsung simak aja sob
Judul: Berbagi Info Seputar Beginner's guide to Construct 2 (Bagian 6) Full Update Terbaru
link: Beginner's guide to Construct 2 (Bagian 6)
"jangan lupa baca juga artikel dari kami yang lain dibawah"

Artikel Terbaru Beginner's guide to Construct 2 (Bagian 6) Update Terlengkap 2017

Instance variables

Instance variables allow each monster to store its own health value. A variable is simply a value that can change (or vary), and they are stored separately for each instance, hence the name instance variable.
Lets add a health instance variable to our monster. Click the monster in the project bar or object bar. Alternatively, you can switch back to the layout and select a monster object. This will show the monster's properties in the properties bar. Click Add/edit by Edit variables.
Adding a new instance variable.
The Instance Variables dialog appears. It looks similar to the Behaviors dialog we saw earlier, but instead allows you to add and change instance variables for the object. Click the green Add button to add a new one.
Adding the 'health' instance variable.
In the dialog that pops up, type health for the name, leave Type as Number, and for Initial value enter 5 (as shown). This starts every monster on 5 health. When they get hit we'll subtract 1 from the health, and then when health is zero we'll destroy the object.
Once you're done click OK. Notice the variable now appears in the instance variables dialog and also in the properties for the monster as well. (You can quickly change initial values in the properties bar, but to add or remove variables you'll need to click the Add / Edit link.)
The health instance variable now added to the monster.

Changing the events

Switch back to the event sheet. Right now, we're destroying monsters as soon as the bullet hits them. Let's change that to subtract 1 from its health.
Find the event that reads: Bullet - on collision with Monster. Notice we've got a "destroy monster" action. Let's replace that with "subtract 1 from health". Right click the "destroy monster" action and click Replace.
Replacing an action.
The same dialog appears as if we were inserting a new action, but this time it'll replace the action we clicked instead. Choose Monster -> Subtract from (in theInstance variables category) -> Instance variable "health", and enter 1 for Value. Click Done. The action should now appear like this:
Subtracting 1 from monster's health.
Now when we shoot monsters they lose 1 health and the bullet explodes, but we haven't made an event to kill monsters when their health reaches zero. Add another event:
Condition: Monster -> Compare instance variable -> Health, Less or equal, 0
Action: Monster -> Spawn another object -> Explosion, layer 1
Action: Monster -> Destroy
The completed event.
Why "less or equal 0" rather than "equals 0"? Suppose we added another more powerful weapon which subtracted 2 from health. As you shot a monster, its health would go 531-1-3... notice at no point was its health directly equal to zero, so it'd never die! Therefore, it's good practice to use "less or equal" to test if something's health has run out.
Run the game. You now have to hit monsters five times to kill them!

Keeping score

Let's have a score so the player knows how well they've done. We'll need another variable for this. You might think "lets put the score as one of the player's instance variables!". That's not a bad first idea, but remember the value is stored "in" the object. If there are no instances, there are no variables either! So if we destroy the player, we can no longer tell what their score was, because it was destroyed with the player.
Instead, we can use a global variable. Like an instance variable, a global variable (or just "global") can store text or a number. Each variable can store a single number or a single piece of text. Global variables are also available to the entire game across all layouts - convenient if we were to add other levels.
Right-click the space at the bottom of the event sheet, and select Add global variable.
Add a global variable.
Enter Score as the name. The other field defaults are OK, it'll make it a number starting at 0.
Adding the Score global.
Now the global variable appears as a line in the event sheet. It's in this event sheet, but it can be accessed from any event sheet in any layout.
The Score global variable.
Note: there are also local variables which can only be accessed by a smaller "scope" of events, but we don't need to worry about that right now.
Let's give the player a point for killing a monster. In our "Monster: health less or equal 0" event (when a monster dies), click Add action, and select System -> Add to (under Global & local variables) -> Score, value 1. Now the event should look like this:

The event giving the player some score.
Now the player has a score, which increases by 1 for every monster they kill - but they can't see their score! Let's show it to them with a text object.

Itulah sedikit Artikel Beginner's guide to Construct 2 (Bagian 6) terbaru dari kami

Semoga artikel Beginner's guide to Construct 2 (Bagian 6) yang saya posting kali ini, bisa memberi informasi untuk anda semua yang menyukai Apps Android Games. jangan lupa baca juga artikel-artikel lain dari kami.
Terima kasih Anda baru saja membaca Artikel Tentang Beginner's guide to Construct 2 (Bagian 6)