2/11


Any interest in working on a game?

From PM Student Angel Delgado 

I am making a card game and there are 200 card arts that are needed. I don’t want to do that and I think it would be better, if I had people with different art styles do art for the game like in the Pokémon TCG. If you want to make an image (like the stickman one) for my card game here are the rules.


 The image must be in the scale of 250x100 The image must be a png or jpg file Can be any art style (digital, hand-drawn [must be converted to a png via scanning, etc], pixel art) Must not have any transparent details (E.I. fill the full image will a color at least. 


Also if you do a image, please go to the link and "suggest" you name in the artist section (type the name/username that will be used in the credits) Then email me the image at mdelgado1322@gmail.com

  Link to doc: https://docs.google.com/document/d/1ax9Hm8B7iMeTifwDxqvTC0FLcC6EdfLRW3N7PPJ1Q5o/edit?usp=sharing


 If you have any questions, dm me on discord at Dinoplant.



Start your day with a warm-up


The Superbowl has become a bit of a cultural event. Did you watch? Why or why not? If you did, what did you think og it? The Commercials? Were you at an event or chilling at home? Did people come over? Talk about it.


If you didn't watch, what did you do instead?


Half page or no credit. 



What are you learning?

Conditional statements, branches and boolean... oh my!


Why is it important?

We use conditional statements to make something happen if the criteria is met like having a key to open a door 

How do you show that you understand? What is the assignment?

Complete lesson 4

In the content drawer, open the game folder that is inside your blueprints folder and double click BP_HourOfCode_Game then dock it

We are going to add a a branch in the Blueprint 

hold the B key while in your blueprint then left mouse click (LMC) to add

In UE Blueprints, they use what is called a branch (the node you just added)

If you have ever messed with code.org, you know about the "if-then" or "If-then-else" statements

An example in GDevelop would be If sprite is in collision with coin then delete coin

So the condition box is the most important part of this branch

If the box is checked (see my blue check)

This mean it is turned on

So if the condition is "in collision with coin" and the player overlaps the coin collision, the statement is true and the program will continue through the true output on the node

But if the condition is "in collision with coin" and the player has not overlapped the coin collision, the statement is false and the program will continue through the false output on the node

Check out your blueprint and open the Player Inv Folder

Check out the Boolean Variable haveKey?

This is a condition that can be added to the branch (notice it is the same color as the condition in the branch?

Drag  the haveKey? variable out to your blueprint

You will not have options

Get haveKey? - Do we have this information

and

Set haveKey? - Are we going to Set this information

Select Get haveKey?

Now it add the node and you can connect red to red

Go ahead and delete the Branch and haveKey 

In your content drawer, open up the BP_Door_Locked that is in the blueprints folder and dock it

Connect the nodes

So what is happening here is that the condition is having the key and if the condition is met or "true" than it moves on to the Do once

If the condition is false, the program is over

Compile and Save

Get back into your game

Press 5 on your keyboard so you get to the activity 4 destination

Set the Start Game at Current Camera Location (the three dots to the right of the play button) so we don''t start from the beginning

Play the game and walk up to the door

You will see a message Key Needed

I have put in Show Collision in the CMD prompt 

You can see that there is a collision at the door. When the layer collides with the door collision, the blueprint runs a check to see if you have the key (condition being the variable is true)

Open your Blueprints folder

Right Click in the empty space

hover to Blueprints>Blueprints Class

Choose Actor

Name your Blueprint BP_Key or whatever you wish to call it

Drag your blueprint into your world

Once again, your blueprint can send information to your game and the game can send information to your blueprint (like a collision has happened for example)

Double click on your key blueprint and dock it

It will open to your viewport

Look over to the Components tab on the top left

Click add

Type sphere collision on the search

Select the Sphere Collision

Name it Sphere_Coll

The Sphere Collision does not show up in when you play the game so we need to add a mesh for the play to get

To do this, we will go back to components and add static mesh 

When we added the static mesh, we had the sphere collision selected so it added the static mesh as a child of the sphere collision

All you need to do to fix this is drag it into the DefaultSceneRoot

Select Attach

Select your StaticMesh in components and look for the Static Mesh in your details panel

In your details panel, click the None

Type Key in the search

Select SM_Key

In components tab, click Sphere_Coll

Move the collision around the key

Compile and save

 Go to the key event graph in the blueprint

Delete the three nodes

In the components panel on the left side

Select the sphere collision

On the right side details panel select On Component begin overlap by clicking the +

This will add a node to the Event Graph

We are going to pull out a connection from the white output

a search box will come up and we want to select Cast To BP Hour of Code Game so that we are sending the info to the game

From the Object input of the Cast To GameMode Node, pull out a connection and search for Get Game Mode and Select  

From the As BP Hour of Code Game, pull out and search for the Set Have Key variable

Uncheck context sensitive if you can't find it

Now you should have the blue connecting the nodes

Set the key to true by checking the box

Connect the white nodes so it goes into the next node

So now when the character touches the collision of the key, the key blueprint sends the info to the game telling it that the character has the key

Let's add a sweet sound

Pull from the white output and search play sound

Select Play Sound 2D

Choose a sound and test it out

Notice it will play the sounds when you touch the key and you can now open the door BUT the key does not disappear.

Why is this?

Because you didn't add it in the blueprint

 Let's get rid of the key

From the white output of the Play Sound 2D, we will add Destroy Actor

Target Self means the blueprint from the game

Compile save and test 

Time to end the game

Open your blueprints folder in the content drawer

Drag BP_endGoal in your game

Rotate so you can see the word goal

Play test the game from the beginning

Take a few minutes to make your game more fun... if it is unreasonably easy or difficult, modify it


Now open your blueprints and open up BP_Door_Locked_activity_4_end

Let's check out the start of the blueprint

So when the character collides with the door, it moves to the boolean branch that checks to see if the door is open

If door open is true, that is the end of it

If door open is false, it moves on to the next node which means it is going to send info to the game aka cast to BP_HourOfCode_Game

In this section, we have another boolean that is checking to see if the condition player have key is true

Here we are saying if the player has the key, enable the input (allow you to open the door by pressing the E key)

If it is false and you don't have the key, it moves on to a bunch of nodes that basically tell you that you need a key to get in

This is stating that when the player walks away from the collision, the input is disabled so the player can't open the door

So when the Input is enables and the E is pressed, it also starts up the second node

So when you press E, it casts back to the game and checks to see if you have the key (boolean)

The Do Once Node is just telling the game to only take the key out of inventory by changing the boolean to False by Have Key unchecked

Then playing a sound

This section is what moves the door

Once the input hits play it moves the door to a new location

Then we have another boolean that sets the Door Open to True so that if the door is collided with again is ends the blueprint

Next part is what makes the key show up in your UI on screed.

HUD Ref = Heads up display T Key is the texture image that shows up

Creating an obect that will kill the character

When the player overlaps the collision on the object, it casts to the Character then the actor (character) detroys itself

Blueprint has a Capsul Collision and a Static Mesh that is a Spike

Adding a respawn

In the Game Mode Blueprint

Righ Click in the Event Gaph and add custom event

Name the custom event Respawn Player

Under Inputs in the details panel, click the +

Name the input Player