Intermediate Tutorial Part 4/4: How do I Create a Treasure Pickup that Wins the Game?

From The Endless Mission Wiki
Jump to: navigation, search
Before following this tutorial module, make sure that you are:
  • Either starting with "Barebones Game" Loaded into the Editor,
  • Or starting from your saved copy of your Game that you used while following the other modules of this tutorial.
IntermediateTutorial4-1.png

Initial Preparation[edit | edit source]

  1. First, in your Project Hierarchy, find "Gameplay/Win Trigger" and Right-click to delete it. This is the old trigger that governs the win condition of the game that you started with. We'll be recreating the Win Trigger that the "Barebones Game" uses by default (collecting the Golden Pineapple) from the ground up. Yes, this means if you started with the "Barebones Game" for this tutorial, you just deleted the exact same thing we'll ultimately be making. Don't think about it too hard... The point is, we need to delete this Asset from our Project Hierarchy so it doesn't conflict with our new work.
  2. Right-click on the Gameplay entity in your Project Hierarchy and select "Create Empty" from the dropdown that appears, rename to “Win Pineapple”. Search for “Trigger” in the Library, and drag and drop the “TriggerVolume” Script onto the “Win Pineapple” entity you just made.
IntermediateTutorial4-2.png

Setting Up The Pickup's Visuals[edit | edit source]

  1. Search for "pineapple" in the Library.
  2. From the Library, drag "Golden Pineapple Visuals" to your existing "Win Pineapple" in the Project Hierarchy. This will make the visuals a child of the trigger.
  3. With "Golden Pineapple Visuals" still selected, make sure its Properties Panel is visible:
  4. Numerically set Rotation X to -90.
  5. Numerically set Scale to 0.2, 0.2, 0.2.
  6. Now, in your Viewport, move "Win Pineapple" and nudge its position so that it sits nicely on the rooftop. Both the Pineapple and the Trigger Volume should move together.
IntermediateTutorial4-3.png

Final Pickup Configuration[edit | edit source]

  1. Make sure "Win Pineapple" is selected and its Properties Panel is visible.
  2. In the Properties, click the "+" on the "Trigger Enter" field to expand it and make "Target" field visible.
  3. Then, from your Project Hierarchy: Drag "Gameplay/ GameplayLogic" to the "Target" field of "Win Pineapple".
  4. Finally, click on the "No Function" drop down right under it, and select "PlayerWon()". This will make it so that when you touch the pickup, you will win the game.
  5. Now is a good time to press Play and test everything.
  6. Make sure your Avatar is positioned in a good starting place, and the Tower is also in a good position for gameplay.
  7. Congratulations! You have completed this tutorial and now have the knowledge to create a simple Game.