PHONES AWAY!!! It's too much already
Pro-Dress will now be worth 3 Points per week starting 10/9
Starting next week, we will be testing an A/B Schedule for English.
A Week
Mon - Third
Tues - None
Wed - Second
Thur - First
Fri - None
B Week
Mon - Third
Tues - None
Wed - First
Thur - Second
Fri - Third
Start off the day with the warm-up
Read the article, summarize and share your thoughts. What happened to Destiny and why do YOU think it is happening??
https://gamerant.com/destiny-2-steam-concurrent-player-count-low/
Half page
Three Points
What are you learning?
Gdevelop
Scene Variable vs global variable
Coin counting
Life system
Why is it important?
This is what we use for 2D games
How do you show that you understand? What is the assignment?
Follow the directions and complete the lesson with me.
Once you are finished, add all the elements we went over today in your CARTKour Game
Create a new object
Select text
Object Name: score Display
Size: 50 Bold
Text: Score :
Place the Score : in the top left of your screen
Move the Score : object to the front layer
Open up your scene properties and click Edit Scene Variables
Create a new Scene Variable and name it Score
We will use this variable to hold the number of coins we have collected
Create a new group
Add a new event in your Score Event Group and remove it from your collision group
Add an additional action to this event
Action: Change variable value
Variable: Score
Modification's sign: + (add)
Value: 1
What we are doing here is adding 1 to the variable each time the player collides with the coin
Add another event to your Score Group
Action: Text
Object: ScoreDisplay
Text: "Score : " + VariableString(Score)
What is happening is that we are adding the current score variable after Score : on the screen
If we want to keep the coin counting troughout the game, we will need to change this from a scene variable to a global variable
All we have to do is change action to use the global variable that we created instead of the scene variable and change the VariableString to Globals
Create a new Sprite
Name it Heart
64x64
Make a Heart in Piskel
Create a 64 x 64 Tile Sprite with the same art
Place your Heart in the game where your player can collide with it
Place your TileHeart below the score
Move the TileHeart to the Front Layer so that it is always in the same place on your play area
Create a new Event Group called Health
Create new event
Condition
Object: Hero
Object Variable Value
Add or edit variables
Add a variable
Name the Variable Health
It is going to be a number and we want it to start at 2 (because we want to start with two lives)
Create a new event
Condition
Hero
Collision
Heart
Action
Hero
Change Object Variable Value
Variable: Health
Modification Sign: +(add)
Value: 1
So each time the hero collides with a heart, 1 is added to the health variable
Go ahead and remove "The variable Health of Hero"
Add a new event
Condition is Always
Action
Object: TileHeart
Width
Width: Hero.Variable(Health) * 64
So whatever the Health Variable for our Hero (aka lives) will be multiplied by 64 (the width of our tiled sprite)
Our tiled sprite Heart is 64px wide so if we have 1 life, the width of the tiles sprite is 1 x 64 = 64 so it only shows one sprite
If we had two lives, our variable is 2.
2 x 64 = 128
128px would show two hearts
When you collide with the heart, the Health variable will continue to add 1 until you are no longer in collision
You need to add delete heart before you add one to the health variable so that it only happens once
Now that we have a life system in place, you want your collisions with the bad items to take away a life so delete your events that collide with blade, bad guy, bat, etc and change scene (you could also move them down to the Health Group and modify them if you prefer)
New Event
Condition: Hero is in collision with death
Action:
Hero
Change Object Variable Value
Health Subtract 1 (because we want to lose a life when we hit death)
By deleting the old collision with death, we have created a bug where the game does not restart. If you added change to scene, it would restart the game with two lives every time and reset the variable every time so we need to create a spawn point
Create a new object
Sprite
Name it Spawn but do not create any art
Drag your spawn object into your game where you want to respawn
Chane the Z order so that it is behind your hero
Now add another action to your Hero in Collision with Death event
Hero
Position
Spawn.X()
Spawn.Y()
Test and save
Do this for all baddies in your game