SlideShare uma empresa Scribd logo
1 de 13
Petri Lankoski
Contents
 Waypoint track
 Enemy following waypoint track
 PlayerLogic keeping track of Power and
  Health stats
     Displaying health & power meter with GUI
 Scaling GUI to different screen sizes
 PowerUp
Waypoint
public class Waypoint : MonoBehaviour {
            public Transform nextTarget;
            public string agentTag; // Tag of the things we set the new target
            void OnTriggerEnter(Collider other) {
                                     if(other.gameObject.CompareTag(agentTag)) {
                                     SendNextTarget(other.gameObject);
                         }
            }
            void OnDrawGizmos() {
                         Gizmos.DrawIcon (transform.position, "waypoint.psd");
                         if(nextTarget) {
                                     Gizmos.color = Color.red;
                                     Gizmos.DrawLine(transform.position, nextTarget.position);
                         }
            }
            private void SendNextTarget(GameObject obj) {
                         Enemy script = obj.GetComponent<Enemy>();
                         script.SetTarget(nextTarget);
            }
}
Waypoint.psd
Waypoint                                         (etc, other formats
                                                 Works)


   Setup
     Waypoint prefab
      ○ With Waypoint script attached
      ○ With collider in trigger mode (is trigger set)
     Gizmos/waypoint.psd
      ○ Size should be 32x32 or 25x25 pixels

 Create a track using waypoints
 TEST
Waypoint setup, one track
Waypoint setup, two tracks
Enemy Following Waypoints
   Enemy c# class
     Enemy target in public Transform
      ○ So we can set the first target waypoint on the inspector
     Implement
      ○ public void SetTarget(Transform newTarget) { /* Store newTarget
         to private variable of Enemy class here*/ }
     Make enemy move by the track set with Waypoints
      ○ Use Update() for this
      ○ transform.LookAt()
      ○ transform.Translate(), Time.deltaTime
   Create Enemy prefeb
     Create new tag and set tag to Enemy (or something depending
      the value of agentTag)
     Set the tag to Enemy (or to match the AgentTag variable) to the
      waypoints on your track
   TEST
Second Enemy
   Make an enemy follow different track
     Create new tag and set tag to Enemy
     Set the tag (to the AgentTag variable) to the
     waypoints on your track
Player Object
   Add FirstPersonController to           public class GUIGlobals {
    scene                                    public const float screenWidth = 1280.0f;
     Standard Assets/Character              public const float screenHeight = 800.0f;
      Controllers
                                             public static Matrix4x4 GetGUIMatrix() {
   Create PlayerLogic.cs
     Add meters for health and
                                               float xScale=Screen.widt /screenWidth;
      power                                    float yScale=Screen.height/screenHeight;
     OnGUI():                                 return Matrix4x4.TRS(
      ○ GUI.matrix = GUIGlobals
        .GetGUIMatrix();                            Vector3.zero,
      ○ Use GUI.DrawTexture() &                     Quaternion.identity,
        changing the height or width of
        the texture
                                                    new Vector3(xScale, yScale, 1)
      ○ Drawing are for DrawTexture:                );
          new Rect(x, y, width, height)     }
     power & health as public
      variable for testing
                                           }
GUI.matrix & GUIGlobals
                                      0,0               GUIGlobals.screenWidth,0

    Scales the GUI for
     you in any screen
     sizes
    Layout according to
     values set in
     GUIGlobals
new Rect(GUIGlobals.screenWidth-40,
GUIGlobals.screenHeight-40,
20,20)

                                                    GUIGlobals.screenWidth,
                                                    GUIGlobals.screenHeight
                            0,GUIGlobals.screenHeight
Shortcut to Player, Singleton
public class GameAgents : MonoBehaviour {
  private static GameAgents instance;
  private GameObject player;
  private PlayerLogic playerLogic;
  void Awake() {
        instance = this;
        player = GameObject.FindWithTag("Player");
        playerLogic = player.GetComponent<PlayerLogic>();
   }
   public static GameObject GetPlayer() { return instance.player;}
   public static PlayerLogic GetPlayerLogic() {
          return instance.playerLogic;
   }
}
GameAgents
 Add to an empty game object
 Allows easy access to Player object and
  PlayerLogic classes from other classes
     GameObject pc = GameAgents.GetPlayer();
     PlayerLogic pl =
      GameAgents.GetPlayerLogic();
     GameAgents.GetPlayerLogic().enabled =
      false;
     GameAgents.GetPlayerLogic().FunctionNam
      e(4,6);
PowerUp
   Expose health and power on inspector
     public int health, power;
   Collider in trigger mode ()
   Catch collision OnTriggerEnter(Collider other)
     Check if player object collided with it
      ○ if(other.gameObject == GameAgents.GetPlayer()) …
          This is faster than tag comparison used in Waypoint
     Send Health and Power to PlayerLogic script
      ○ GameAgents.GetPlayerLogic().PowerUp(health,power)
      ○ You need to add a function for that to PlayerLogic
          public void PowerUp(int powerAdd, int healtAhh) {

Mais conteúdo relacionado

Mais procurados

OpenGL L07-Skybox and Terrian
OpenGL L07-Skybox and TerrianOpenGL L07-Skybox and Terrian
OpenGL L07-Skybox and TerrianMohammad Shaker
 
libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationJussi Pohjolainen
 
The Ring programming language version 1.10 book - Part 78 of 212
The Ring programming language version 1.10 book - Part 78 of 212The Ring programming language version 1.10 book - Part 78 of 212
The Ring programming language version 1.10 book - Part 78 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 67 of 202
The Ring programming language version 1.8 book - Part 67 of 202The Ring programming language version 1.8 book - Part 67 of 202
The Ring programming language version 1.8 book - Part 67 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 61 of 181
The Ring programming language version 1.5.2 book - Part 61 of 181The Ring programming language version 1.5.2 book - Part 61 of 181
The Ring programming language version 1.5.2 book - Part 61 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 64 of 185
The Ring programming language version 1.5.4 book - Part 64 of 185The Ring programming language version 1.5.4 book - Part 64 of 185
The Ring programming language version 1.5.4 book - Part 64 of 185Mahmoud Samir Fayed
 
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeksBeginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeksJinTaek Seo
 
Implementing a Simple Game using libGDX
Implementing a Simple Game using libGDXImplementing a Simple Game using libGDX
Implementing a Simple Game using libGDXJussi Pohjolainen
 
Petri Niemi Qt Advanced Part 1
Petri Niemi Qt Advanced Part 1Petri Niemi Qt Advanced Part 1
Petri Niemi Qt Advanced Part 1NokiaAppForum
 
Petri Niemi Qt Advanced Part 2
Petri Niemi Qt Advanced Part 2Petri Niemi Qt Advanced Part 2
Petri Niemi Qt Advanced Part 2NokiaAppForum
 
Computer Graphics Project on Sinking Ship using OpenGL
Computer Graphics Project on Sinking Ship using OpenGLComputer Graphics Project on Sinking Ship using OpenGL
Computer Graphics Project on Sinking Ship using OpenGLSharath Raj
 
Trident International Graphics Workshop 2014 4/5
Trident International Graphics Workshop 2014 4/5Trident International Graphics Workshop 2014 4/5
Trident International Graphics Workshop 2014 4/5Takao Wada
 
The Ring programming language version 1.5.2 book - Part 62 of 181
The Ring programming language version 1.5.2 book - Part 62 of 181The Ring programming language version 1.5.2 book - Part 62 of 181
The Ring programming language version 1.5.2 book - Part 62 of 181Mahmoud Samir Fayed
 
Look Mommy, No GC! (TechDays NL 2017)
Look Mommy, No GC! (TechDays NL 2017)Look Mommy, No GC! (TechDays NL 2017)
Look Mommy, No GC! (TechDays NL 2017)Dina Goldshtein
 
The Ring programming language version 1.5.2 book - Part 63 of 181
The Ring programming language version 1.5.2 book - Part 63 of 181The Ring programming language version 1.5.2 book - Part 63 of 181
The Ring programming language version 1.5.2 book - Part 63 of 181Mahmoud Samir Fayed
 
Deep dive into deeplearn.js
Deep dive into deeplearn.jsDeep dive into deeplearn.js
Deep dive into deeplearn.jsKai Sasaki
 
Workshop with python qgis
Workshop with python qgisWorkshop with python qgis
Workshop with python qgisQust04
 

Mais procurados (20)

OpenGL L07-Skybox and Terrian
OpenGL L07-Skybox and TerrianOpenGL L07-Skybox and Terrian
OpenGL L07-Skybox and Terrian
 
libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame Animation
 
GLSL
GLSLGLSL
GLSL
 
The Ring programming language version 1.10 book - Part 78 of 212
The Ring programming language version 1.10 book - Part 78 of 212The Ring programming language version 1.10 book - Part 78 of 212
The Ring programming language version 1.10 book - Part 78 of 212
 
The Ring programming language version 1.8 book - Part 67 of 202
The Ring programming language version 1.8 book - Part 67 of 202The Ring programming language version 1.8 book - Part 67 of 202
The Ring programming language version 1.8 book - Part 67 of 202
 
The Ring programming language version 1.5.2 book - Part 61 of 181
The Ring programming language version 1.5.2 book - Part 61 of 181The Ring programming language version 1.5.2 book - Part 61 of 181
The Ring programming language version 1.5.2 book - Part 61 of 181
 
The Ring programming language version 1.5.4 book - Part 64 of 185
The Ring programming language version 1.5.4 book - Part 64 of 185The Ring programming language version 1.5.4 book - Part 64 of 185
The Ring programming language version 1.5.4 book - Part 64 of 185
 
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeksBeginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
 
Implementing a Simple Game using libGDX
Implementing a Simple Game using libGDXImplementing a Simple Game using libGDX
Implementing a Simple Game using libGDX
 
Petri Niemi Qt Advanced Part 1
Petri Niemi Qt Advanced Part 1Petri Niemi Qt Advanced Part 1
Petri Niemi Qt Advanced Part 1
 
OpenVX 1.0 Reference Guide
OpenVX 1.0 Reference GuideOpenVX 1.0 Reference Guide
OpenVX 1.0 Reference Guide
 
Petri Niemi Qt Advanced Part 2
Petri Niemi Qt Advanced Part 2Petri Niemi Qt Advanced Part 2
Petri Niemi Qt Advanced Part 2
 
Computer Graphics Project on Sinking Ship using OpenGL
Computer Graphics Project on Sinking Ship using OpenGLComputer Graphics Project on Sinking Ship using OpenGL
Computer Graphics Project on Sinking Ship using OpenGL
 
Trident International Graphics Workshop 2014 4/5
Trident International Graphics Workshop 2014 4/5Trident International Graphics Workshop 2014 4/5
Trident International Graphics Workshop 2014 4/5
 
libGDX: Tiled Maps
libGDX: Tiled MapslibGDX: Tiled Maps
libGDX: Tiled Maps
 
The Ring programming language version 1.5.2 book - Part 62 of 181
The Ring programming language version 1.5.2 book - Part 62 of 181The Ring programming language version 1.5.2 book - Part 62 of 181
The Ring programming language version 1.5.2 book - Part 62 of 181
 
Look Mommy, No GC! (TechDays NL 2017)
Look Mommy, No GC! (TechDays NL 2017)Look Mommy, No GC! (TechDays NL 2017)
Look Mommy, No GC! (TechDays NL 2017)
 
The Ring programming language version 1.5.2 book - Part 63 of 181
The Ring programming language version 1.5.2 book - Part 63 of 181The Ring programming language version 1.5.2 book - Part 63 of 181
The Ring programming language version 1.5.2 book - Part 63 of 181
 
Deep dive into deeplearn.js
Deep dive into deeplearn.jsDeep dive into deeplearn.js
Deep dive into deeplearn.js
 
Workshop with python qgis
Workshop with python qgisWorkshop with python qgis
Workshop with python qgis
 

Destaque

Gameplay Design Workshop 2/2 (2011)
Gameplay Design Workshop 2/2 (2011)Gameplay Design Workshop 2/2 (2011)
Gameplay Design Workshop 2/2 (2011)Petri Lankoski
 
Gameplay Design Workshop 1/2 (2011)
Gameplay Design Workshop 1/2 (2011)Gameplay Design Workshop 1/2 (2011)
Gameplay Design Workshop 1/2 (2011)Petri Lankoski
 
Formal analysis of gameplay
Formal analysis of gameplayFormal analysis of gameplay
Formal analysis of gameplayPetri Lankoski
 
Simulations: Evaluating game system behavior
Simulations: Evaluating game system behavior Simulations: Evaluating game system behavior
Simulations: Evaluating game system behavior Petri Lankoski
 
Game Design, Lecture1: Design
Game Design, Lecture1: DesignGame Design, Lecture1: Design
Game Design, Lecture1: DesignPetri Lankoski
 
Game Development with Unity
Game Development with UnityGame Development with Unity
Game Development with Unitydavidluzgouveia
 
Game research methods book introduction
Game research methods book introductionGame research methods book introduction
Game research methods book introductionPetri Lankoski
 

Destaque (7)

Gameplay Design Workshop 2/2 (2011)
Gameplay Design Workshop 2/2 (2011)Gameplay Design Workshop 2/2 (2011)
Gameplay Design Workshop 2/2 (2011)
 
Gameplay Design Workshop 1/2 (2011)
Gameplay Design Workshop 1/2 (2011)Gameplay Design Workshop 1/2 (2011)
Gameplay Design Workshop 1/2 (2011)
 
Formal analysis of gameplay
Formal analysis of gameplayFormal analysis of gameplay
Formal analysis of gameplay
 
Simulations: Evaluating game system behavior
Simulations: Evaluating game system behavior Simulations: Evaluating game system behavior
Simulations: Evaluating game system behavior
 
Game Design, Lecture1: Design
Game Design, Lecture1: DesignGame Design, Lecture1: Design
Game Design, Lecture1: Design
 
Game Development with Unity
Game Development with UnityGame Development with Unity
Game Development with Unity
 
Game research methods book introduction
Game research methods book introductionGame research methods book introduction
Game research methods book introduction
 

Semelhante a Petri Lankoski's Waypoint Track and Enemy Following Document

Design pattern - part 3
Design pattern - part 3Design pattern - part 3
Design pattern - part 3Jieyi Wu
 
Useful Tools for Making Video Games - XNA (2008)
Useful Tools for Making Video Games - XNA (2008)Useful Tools for Making Video Games - XNA (2008)
Useful Tools for Making Video Games - XNA (2008)Korhan Bircan
 
Lec 7 28_aug [compatibility mode]
Lec 7 28_aug [compatibility mode]Lec 7 28_aug [compatibility mode]
Lec 7 28_aug [compatibility mode]Palak Sanghani
 
The Ring programming language version 1.5.3 book - Part 58 of 184
The Ring programming language version 1.5.3 book - Part 58 of 184The Ring programming language version 1.5.3 book - Part 58 of 184
The Ring programming language version 1.5.3 book - Part 58 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 48 of 184
The Ring programming language version 1.5.3 book - Part 48 of 184The Ring programming language version 1.5.3 book - Part 48 of 184
The Ring programming language version 1.5.3 book - Part 48 of 184Mahmoud Samir Fayed
 
HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?Ankara JUG
 
Task Write a Java program to implement a simple graphics editor tha.pdf
Task Write a Java program to implement a simple graphics editor tha.pdfTask Write a Java program to implement a simple graphics editor tha.pdf
Task Write a Java program to implement a simple graphics editor tha.pdfcronkwurphyb44502
 
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docxasmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docxfredharris32
 
Getting started with GUI programming in Java_1
Getting started with GUI programming in Java_1Getting started with GUI programming in Java_1
Getting started with GUI programming in Java_1Muhammad Shebl Farag
 
Enhancing UI/UX using Java animations
Enhancing UI/UX using Java animationsEnhancing UI/UX using Java animations
Enhancing UI/UX using Java animationsNaman Dwivedi
 
Silverlight as a Gaming Platform
Silverlight as a Gaming PlatformSilverlight as a Gaming Platform
Silverlight as a Gaming Platformgoodfriday
 
Java Graphics
Java GraphicsJava Graphics
Java GraphicsShraddha
 
Modern Android Architecture
Modern Android ArchitectureModern Android Architecture
Modern Android ArchitectureEric Maxwell
 

Semelhante a Petri Lankoski's Waypoint Track and Enemy Following Document (20)

Design pattern - part 3
Design pattern - part 3Design pattern - part 3
Design pattern - part 3
 
Useful Tools for Making Video Games - XNA (2008)
Useful Tools for Making Video Games - XNA (2008)Useful Tools for Making Video Games - XNA (2008)
Useful Tools for Making Video Games - XNA (2008)
 
Unity 13 space shooter game
Unity 13 space shooter gameUnity 13 space shooter game
Unity 13 space shooter game
 
Lec 7 28_aug [compatibility mode]
Lec 7 28_aug [compatibility mode]Lec 7 28_aug [compatibility mode]
Lec 7 28_aug [compatibility mode]
 
Games 3 dl4-example
Games 3 dl4-exampleGames 3 dl4-example
Games 3 dl4-example
 
The Ring programming language version 1.5.3 book - Part 58 of 184
The Ring programming language version 1.5.3 book - Part 58 of 184The Ring programming language version 1.5.3 book - Part 58 of 184
The Ring programming language version 1.5.3 book - Part 58 of 184
 
The Ring programming language version 1.5.3 book - Part 48 of 184
The Ring programming language version 1.5.3 book - Part 48 of 184The Ring programming language version 1.5.3 book - Part 48 of 184
The Ring programming language version 1.5.3 book - Part 48 of 184
 
A More Flash Like Web?
A More Flash Like Web?A More Flash Like Web?
A More Flash Like Web?
 
HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?
 
Task Write a Java program to implement a simple graphics editor tha.pdf
Task Write a Java program to implement a simple graphics editor tha.pdfTask Write a Java program to implement a simple graphics editor tha.pdf
Task Write a Java program to implement a simple graphics editor tha.pdf
 
Griffon @ Svwjug
Griffon @ SvwjugGriffon @ Svwjug
Griffon @ Svwjug
 
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docxasmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
 
MIDP: Game API
MIDP: Game APIMIDP: Game API
MIDP: Game API
 
Getting started with GUI programming in Java_1
Getting started with GUI programming in Java_1Getting started with GUI programming in Java_1
Getting started with GUI programming in Java_1
 
Enhancing UI/UX using Java animations
Enhancing UI/UX using Java animationsEnhancing UI/UX using Java animations
Enhancing UI/UX using Java animations
 
Scmad Chapter07
Scmad Chapter07Scmad Chapter07
Scmad Chapter07
 
Silverlight as a Gaming Platform
Silverlight as a Gaming PlatformSilverlight as a Gaming Platform
Silverlight as a Gaming Platform
 
Java Graphics
Java GraphicsJava Graphics
Java Graphics
 
Modern Android Architecture
Modern Android ArchitectureModern Android Architecture
Modern Android Architecture
 
OpenGL ES 3.1 Reference Card
OpenGL ES 3.1 Reference CardOpenGL ES 3.1 Reference Card
OpenGL ES 3.1 Reference Card
 

Mais de Petri Lankoski

A brief introduction to quantitative analysis
A brief introduction to quantitative analysisA brief introduction to quantitative analysis
A brief introduction to quantitative analysisPetri Lankoski
 
Game Analysis at HEVGA PhD Summer School
Game Analysis at HEVGA PhD Summer SchoolGame Analysis at HEVGA PhD Summer School
Game Analysis at HEVGA PhD Summer SchoolPetri Lankoski
 
Constructive Alignment in Teaching Game Research in Game Development Bachelor...
Constructive Alignment in Teaching Game Research in Game Development Bachelor...Constructive Alignment in Teaching Game Research in Game Development Bachelor...
Constructive Alignment in Teaching Game Research in Game Development Bachelor...Petri Lankoski
 
Level Design Course Intro and Assingnts
Level Design Course Intro and AssingntsLevel Design Course Intro and Assingnts
Level Design Course Intro and AssingntsPetri Lankoski
 
Quantitative analysis: A brief introduction
Quantitative analysis: A brief introductionQuantitative analysis: A brief introduction
Quantitative analysis: A brief introductionPetri Lankoski
 
Embodiment, Game Characters and Game Design
Embodiment, Game Characters and Game DesignEmbodiment, Game Characters and Game Design
Embodiment, Game Characters and Game DesignPetri Lankoski
 
Escape: Level Design Exercise in Unity
Escape: Level Design Exercise in UnityEscape: Level Design Exercise in Unity
Escape: Level Design Exercise in UnityPetri Lankoski
 
Designprocesser lecture1
Designprocesser lecture1Designprocesser lecture1
Designprocesser lecture1Petri Lankoski
 
How can game studies support game design practice?
How can game studies support game design practice?How can game studies support game design practice?
How can game studies support game design practice?Petri Lankoski
 
Game Project / Assignement
Game Project / AssignementGame Project / Assignement
Game Project / AssignementPetri Lankoski
 
Game Project / Working with Unity
Game Project / Working with UnityGame Project / Working with Unity
Game Project / Working with UnityPetri Lankoski
 
Game Analysis, lecture 1
Game Analysis, lecture 1Game Analysis, lecture 1
Game Analysis, lecture 1Petri Lankoski
 
Gameplay Design Workshop 2/3
Gameplay Design Workshop 2/3Gameplay Design Workshop 2/3
Gameplay Design Workshop 2/3Petri Lankoski
 
Gameplay Design Workshop 1/3
Gameplay Design Workshop 1/3Gameplay Design Workshop 1/3
Gameplay Design Workshop 1/3Petri Lankoski
 
Game Design and Procution: Introduction to Studies
Game Design and Procution: Introduction to StudiesGame Design and Procution: Introduction to Studies
Game Design and Procution: Introduction to StudiesPetri Lankoski
 

Mais de Petri Lankoski (20)

A brief introduction to quantitative analysis
A brief introduction to quantitative analysisA brief introduction to quantitative analysis
A brief introduction to quantitative analysis
 
Game Analysis at HEVGA PhD Summer School
Game Analysis at HEVGA PhD Summer SchoolGame Analysis at HEVGA PhD Summer School
Game Analysis at HEVGA PhD Summer School
 
Constructive Alignment in Teaching Game Research in Game Development Bachelor...
Constructive Alignment in Teaching Game Research in Game Development Bachelor...Constructive Alignment in Teaching Game Research in Game Development Bachelor...
Constructive Alignment in Teaching Game Research in Game Development Bachelor...
 
Perforce
PerforcePerforce
Perforce
 
Level Design Course Intro and Assingnts
Level Design Course Intro and AssingntsLevel Design Course Intro and Assingnts
Level Design Course Intro and Assingnts
 
Quantitative analysis: A brief introduction
Quantitative analysis: A brief introductionQuantitative analysis: A brief introduction
Quantitative analysis: A brief introduction
 
Embodiment, Game Characters and Game Design
Embodiment, Game Characters and Game DesignEmbodiment, Game Characters and Game Design
Embodiment, Game Characters and Game Design
 
Escape: Level Design Exercise in Unity
Escape: Level Design Exercise in UnityEscape: Level Design Exercise in Unity
Escape: Level Design Exercise in Unity
 
Level Design
Level Design Level Design
Level Design
 
Game system design
Game system designGame system design
Game system design
 
Models for story
Models for storyModels for story
Models for story
 
Designprocesser lecture1
Designprocesser lecture1Designprocesser lecture1
Designprocesser lecture1
 
How can game studies support game design practice?
How can game studies support game design practice?How can game studies support game design practice?
How can game studies support game design practice?
 
Game Project / Focus
Game Project / FocusGame Project / Focus
Game Project / Focus
 
Game Project / Assignement
Game Project / AssignementGame Project / Assignement
Game Project / Assignement
 
Game Project / Working with Unity
Game Project / Working with UnityGame Project / Working with Unity
Game Project / Working with Unity
 
Game Analysis, lecture 1
Game Analysis, lecture 1Game Analysis, lecture 1
Game Analysis, lecture 1
 
Gameplay Design Workshop 2/3
Gameplay Design Workshop 2/3Gameplay Design Workshop 2/3
Gameplay Design Workshop 2/3
 
Gameplay Design Workshop 1/3
Gameplay Design Workshop 1/3Gameplay Design Workshop 1/3
Gameplay Design Workshop 1/3
 
Game Design and Procution: Introduction to Studies
Game Design and Procution: Introduction to StudiesGame Design and Procution: Introduction to Studies
Game Design and Procution: Introduction to Studies
 

Último

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 

Último (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

Petri Lankoski's Waypoint Track and Enemy Following Document

  • 2. Contents  Waypoint track  Enemy following waypoint track  PlayerLogic keeping track of Power and Health stats  Displaying health & power meter with GUI  Scaling GUI to different screen sizes  PowerUp
  • 3. Waypoint public class Waypoint : MonoBehaviour { public Transform nextTarget; public string agentTag; // Tag of the things we set the new target void OnTriggerEnter(Collider other) { if(other.gameObject.CompareTag(agentTag)) { SendNextTarget(other.gameObject); } } void OnDrawGizmos() { Gizmos.DrawIcon (transform.position, "waypoint.psd"); if(nextTarget) { Gizmos.color = Color.red; Gizmos.DrawLine(transform.position, nextTarget.position); } } private void SendNextTarget(GameObject obj) { Enemy script = obj.GetComponent<Enemy>(); script.SetTarget(nextTarget); } }
  • 4. Waypoint.psd Waypoint (etc, other formats Works)  Setup  Waypoint prefab ○ With Waypoint script attached ○ With collider in trigger mode (is trigger set)  Gizmos/waypoint.psd ○ Size should be 32x32 or 25x25 pixels  Create a track using waypoints  TEST
  • 7. Enemy Following Waypoints  Enemy c# class  Enemy target in public Transform ○ So we can set the first target waypoint on the inspector  Implement ○ public void SetTarget(Transform newTarget) { /* Store newTarget to private variable of Enemy class here*/ }  Make enemy move by the track set with Waypoints ○ Use Update() for this ○ transform.LookAt() ○ transform.Translate(), Time.deltaTime  Create Enemy prefeb  Create new tag and set tag to Enemy (or something depending the value of agentTag)  Set the tag to Enemy (or to match the AgentTag variable) to the waypoints on your track  TEST
  • 8. Second Enemy  Make an enemy follow different track  Create new tag and set tag to Enemy  Set the tag (to the AgentTag variable) to the waypoints on your track
  • 9. Player Object  Add FirstPersonController to public class GUIGlobals { scene public const float screenWidth = 1280.0f;  Standard Assets/Character public const float screenHeight = 800.0f; Controllers public static Matrix4x4 GetGUIMatrix() {  Create PlayerLogic.cs  Add meters for health and float xScale=Screen.widt /screenWidth; power float yScale=Screen.height/screenHeight;  OnGUI(): return Matrix4x4.TRS( ○ GUI.matrix = GUIGlobals .GetGUIMatrix(); Vector3.zero, ○ Use GUI.DrawTexture() & Quaternion.identity, changing the height or width of the texture new Vector3(xScale, yScale, 1) ○ Drawing are for DrawTexture: );  new Rect(x, y, width, height) }  power & health as public variable for testing }
  • 10. GUI.matrix & GUIGlobals 0,0 GUIGlobals.screenWidth,0  Scales the GUI for you in any screen sizes  Layout according to values set in GUIGlobals new Rect(GUIGlobals.screenWidth-40, GUIGlobals.screenHeight-40, 20,20) GUIGlobals.screenWidth, GUIGlobals.screenHeight 0,GUIGlobals.screenHeight
  • 11. Shortcut to Player, Singleton public class GameAgents : MonoBehaviour { private static GameAgents instance; private GameObject player; private PlayerLogic playerLogic; void Awake() { instance = this; player = GameObject.FindWithTag("Player"); playerLogic = player.GetComponent<PlayerLogic>(); } public static GameObject GetPlayer() { return instance.player;} public static PlayerLogic GetPlayerLogic() { return instance.playerLogic; } }
  • 12. GameAgents  Add to an empty game object  Allows easy access to Player object and PlayerLogic classes from other classes  GameObject pc = GameAgents.GetPlayer();  PlayerLogic pl = GameAgents.GetPlayerLogic();  GameAgents.GetPlayerLogic().enabled = false;  GameAgents.GetPlayerLogic().FunctionNam e(4,6);
  • 13. PowerUp  Expose health and power on inspector  public int health, power;  Collider in trigger mode ()  Catch collision OnTriggerEnter(Collider other)  Check if player object collided with it ○ if(other.gameObject == GameAgents.GetPlayer()) …  This is faster than tag comparison used in Waypoint  Send Health and Power to PlayerLogic script ○ GameAgents.GetPlayerLogic().PowerUp(health,power) ○ You need to add a function for that to PlayerLogic  public void PowerUp(int powerAdd, int healtAhh) {