P1kachu presenʦ: How to program with Geometry Dash! (Part 3)
May 25, 2016 0:34:24 GMT -5
SpaceJump, Safyire, and 6 more like this
Post by [ℙ][✓] P1kachu on May 25, 2016 0:34:24 GMT -5
If you haven't read Part 2 yet, please read it first:
gdforum.freeforums.net/thread/28448/p1kachu-presen-program-geometry-dash
Welcome to Part 3 of my "programming" series :3
This part will be longer than the other two because I added 2 examples.
Now, we will talk about "variables".
Variables are usually a display of numbers that shows how many times you have hit, how many keys you have, or what score you have now, etc.
Examples of variables are numbers, toggle state, and others.
In this example, you will now how to make a coin counter.
First is by making a list of variables you will use, arrange them in order.
You can write it as 0, 1, 2, 3. Or be creative by writing "No coins..." "One coin.." "Two coins." "All coins!".
Then, put all of these blocks to Group 1.
Now seperate each text by 6 blocks, or any number of blocks you like..
Then of course, add the coins. And also, put a move trigger in the coins.
So that when the player touches it, the text will go down. The reason why we needed those texts in order.
Last step is to edit the Move Triggers.
Set Move Y to the number of units you seperated the text, which in this example, -60 so the text will go down 60 units (6 blocks).
Set the Move Time to 0, and the Target Group ID to 1.
Now press Save and Play to finish your program...
Now the text should display how many coins you got.
Next, we make another program, is adding a "lives" to the cube.
Just like other games, which have 3 lives, we will add 3 lives for the cube as well.
To do this, start by making the variables, just like in our previous example.
But when we have 0 lives, put a spike or other hazard to kill the cube once it has 0 lives.
Then put this all to Group 1.
Next, we want the hazard to be invisible. So put this to Group 2. and use an Alpha Trigger.
Set the Group ID to 2, FadeTime to 0.0, and Opacity to 0.0.
Now we want to make the player see how many lives he has left. So make the life counter follow the player.
To do this, add a Move Trigger.
Set the Group ID to 1, check the Follow Player X to follow the player's horizontal movement, and Move Time to a long time, 10 seconds is enough.
Next, make the "obstacles". Make sure it doesn't kill the player.
You can use Fake Spikes and Destroyable Blocks for this.
We should make it so that when you touch one of the obstacles, your life decreases by 1.
So like we did before, add a Move trigger.
For the complex obstacles, we need to use the Spawn trigger, to make the whole obstacle count as 1.
If we didn't, the life might decrease by 2, as 2 Move Triggers might be touched.
To do this, put a Move Trigger anywhere. Put this to Group 3. Then, check Spawn Triggered.
Now, place a Spawn Trigger in the obstacle and set it to Group ID 3.
So now, when the cube touches the Spawn Trigger, the Move Trigger will be triggered.
For 2 or more obstacles, set it for different groups.
Then finally, Save and Play, and you're done!
The cube should die as soon as it runs out of lives.
Thank you for reading, I hope you liked this thread.
I spent about 30 minutes for this, I hope you leave a like
Part 4:
gdforum.freeforums.net/thread/28579/p1kachu-presen-program-geometry-dash
gdforum.freeforums.net/thread/28448/p1kachu-presen-program-geometry-dash
Welcome to Part 3 of my "programming" series :3
This part will be longer than the other two because I added 2 examples.
Now, we will talk about "variables".
Variables are usually a display of numbers that shows how many times you have hit, how many keys you have, or what score you have now, etc.
Examples of variables are numbers, toggle state, and others.
In this example, you will now how to make a coin counter.
First is by making a list of variables you will use, arrange them in order.
You can write it as 0, 1, 2, 3. Or be creative by writing "No coins..." "One coin.." "Two coins." "All coins!".
Then, put all of these blocks to Group 1.
Now seperate each text by 6 blocks, or any number of blocks you like..
Then of course, add the coins. And also, put a move trigger in the coins.
So that when the player touches it, the text will go down. The reason why we needed those texts in order.
Last step is to edit the Move Triggers.
Set Move Y to the number of units you seperated the text, which in this example, -60 so the text will go down 60 units (6 blocks).
Set the Move Time to 0, and the Target Group ID to 1.
Now press Save and Play to finish your program...
Now the text should display how many coins you got.
Next, we make another program, is adding a "lives" to the cube.
Just like other games, which have 3 lives, we will add 3 lives for the cube as well.
To do this, start by making the variables, just like in our previous example.
But when we have 0 lives, put a spike or other hazard to kill the cube once it has 0 lives.
Then put this all to Group 1.
Next, we want the hazard to be invisible. So put this to Group 2. and use an Alpha Trigger.
Set the Group ID to 2, FadeTime to 0.0, and Opacity to 0.0.
Now we want to make the player see how many lives he has left. So make the life counter follow the player.
To do this, add a Move Trigger.
Set the Group ID to 1, check the Follow Player X to follow the player's horizontal movement, and Move Time to a long time, 10 seconds is enough.
Next, make the "obstacles". Make sure it doesn't kill the player.
You can use Fake Spikes and Destroyable Blocks for this.
We should make it so that when you touch one of the obstacles, your life decreases by 1.
So like we did before, add a Move trigger.
For the complex obstacles, we need to use the Spawn trigger, to make the whole obstacle count as 1.
If we didn't, the life might decrease by 2, as 2 Move Triggers might be touched.
To do this, put a Move Trigger anywhere. Put this to Group 3. Then, check Spawn Triggered.
Now, place a Spawn Trigger in the obstacle and set it to Group ID 3.
So now, when the cube touches the Spawn Trigger, the Move Trigger will be triggered.
For 2 or more obstacles, set it for different groups.
Then finally, Save and Play, and you're done!
The cube should die as soon as it runs out of lives.
Thank you for reading, I hope you liked this thread.
I spent about 30 minutes for this, I hope you leave a like
Part 4:
gdforum.freeforums.net/thread/28579/p1kachu-presen-program-geometry-dash