lecture 7 Our First Project

Slides:



Advertisements
Similar presentations
7.2. AI E NGINE AND S TEERING B EHAVIOUR I Design of an AI Engine and introduction to steering in game AI.
Advertisements

UFCFSU-30-13D Technologies for the Web Creating and Updating a Graphical Heads-Up Display (HUD)
Animation Mrs. C. Furman. Animation  We can animate our crab by switching the image between two pictures.  crab.png and crab2.png.
GameCamp! and Game Davis Introduction to Unity®
GameCamp! and Game Davis Creating a 2D Platformer in Unity.
GameCamp! and Game Davis Introduction to Scripting in Unity®
HELLO WORLD: YOUR FIRST PROGRAM CHAPTER Topics  Hello World?  Creating a Unity Project –The Unity Project Folder  MonoDevelop: Unity's Code Editor.
The Accelerometer and Gyroscope
SE 320 – Introduction to Game Development Lecture 11: Animations and GoKit Lecturer: Gazihan Alankuş Please look at the last slides for assignments (marked.
SE 320 – Introduction to Game Development Lecture 4: Programming in Unity & Project Presentations Lecturer: Gazihan Alankuş Please look at the last two.
SE 350 – Programming Games Lecture 6: Programming with Unity Lecturer: Gazihan Alankuş Please look at the last slide for assignments (marked with TODO)
Derived from Kirill Muzykov’s Rocket Mouse Tutorial WakeUpAndCode.com.
UFCEKU-20-3Web Games Programming Unity 3D Basic Concepts Using and Creating Prefabs.
SE 350 – Programming Games Lecture 1: Introduction Lecturer: Gazihan Alankuş Please look at the last two slides for assignments (marked with TODO) 2/10/20121.
SE 350 – Programming Games Lecture 7: Programming with Unity Lecturer: Gazihan Alankuş Please look at the last slide for assignments (marked with TODO)
Web Games Programming Unity Scripting Fundamentals.
UFCFS D Technologies for the Web Unity 3D: Review of Topics and Related Concepts.
SE 320 – Introduction to Game Development Lecture 3: Unity’s Interface and Concepts Lecturer: Gazihan Alankuş Please look at the last two slides for assignments.
SE 320 – Introduction to Game Development Lecture 7: Programming Lecturer: Gazihan Alankuş Please look at the last two slides for assignments (marked with.
Yingcai Xiao Game Development Intro to Unreal Engine.
UFCEK-20-3Web Games Programming Unity 3D: Review of Topics Publishing for the Web.
LESSON #10: Digital Playtesting & Introduction to Character Animation with Mecanim DGMD E-70 Principles of Game Design.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
SE 320 – Introduction to Game Development Lecture 2: Introduction to Unity Lecturer: Gazihan Alankuş Please look at the last two slides for assignments.
GameDevClub CODE CHEAT SHEET NOTE: ALL OF THE CODE IS CASE-SENSITIVE AND THE SYNTAX IS STRICT SO A LOT OF YOUR ERRORS WILL PROBABLY COME FROM TYPOS If.
11 Adding a Bread Bat Session Session Overview  We have created a cheese sprite that bounces around the display  We now need to create a bread.
Expressive Intelligence Studio // Center for Games and Playable Media // Unity Pro John Murray Expressive.
Cosc 5/4735 Unity 3D Getting Started Guide for Android.
Yingcai Xiao Game Development with Unity3D Inside/Outside Unity3D.
Behavior trees & The C# programming language for Java programmers
UFCEKU-20-3Web Games Programming Creating and Updating a Graphical Heads-Up Display (HUD)
Digital Game Design ACST 3710 Your First Unity Program 1.
EEC-693/793 Applied Computer Vision with Depth Cameras
COMP 50 Game Design LESSON #11: Digital Playtesting & Introduction to Character Animation with Mecanim.
Quick Intro to Unity Lecture 2.
Game Development with Unity3D Inside/Outside Unity3D
First Person Shooter Project
3GB3 Game Design Unity 3D Basics.
More (C#) Scripting Day 2, Lesson 1.
Unity 2D: Step by Step, Part 4
EEC-693/793 Applied Computer Vision with Depth Cameras
DGMD E-70 Principles of Game Design
Character Selection from a lobby in Unity
EEC-693/793 Applied Computer Vision with Depth Cameras
Animation Scrolling Screens.
C# Basics Part2 These slides are designed for Game Design Class
Unity 2D: Step by Step, Part 2
lecture 8 Our First Project
Oculus Rift DK2 + Leap Motion Unity Tutorial
Game Development Intro to Unreal Engine
C# Basics These slides are designed for Game Design Class
Create a Simple UI Game in 10 Steps
Recap Week 2 and 3.
Week 6: Time and triggers!
lecture 9 Our First Project
Myo + Oculus Rift Tutorial
Image #1 Getting Started
Understanding Conditions
Lecture Notes – Week 2 Lecture-2
Fundaments of Game Design
Fundaments of Game Design
EEC-693/793 Applied Computer Vision with Depth Cameras
Deeper into the Depths: Casting, Scope, Gizmos, Layers, Self-Destruct.
DGMD E-70 Principles of Game Design
U N I T 5A.
Unity Game Development
Chapter 2 Sets Active Learning Lecture Slides
Unity Game Development
Cmake + Physics Lecture 2.
Presentation transcript:

lecture 7 Our First Project 06.11.2017 These slides are designed for Game Design Class Science and Culture University By Alireza Seddighi. Email: alirezaseddighi@live.com

Importing assets

player-animations

Animator

Prefabs Colliders Rigid Bodies

Payer Script In the Asset Folder Create a folder for Scripts and then create your first script Attach the script to player prefab Open the script

Payer Script Defining the variables Create 2 public variables :    public float speed = 8f, maxVelocity = 4f; Create 2 private variables for rigid body and animator private Rigidbody2D myBody; //For adding force to rigid body and make it move private Animator anim; //For controlling the animator

Payer Script the awake function and getting component void Awake(){         myBody = GetComponent<Rigidbody2D> ();         anim = GetComponent<Animator> ();     } Or above the components variable type [SerializeField] [SerializeField]      private Rigidbody2D myBody;      private Animator anim;

Payer Script Movement void playerMoveKey(){         float forceX = 0f;         float vel = Mathf.Abs (myBody.velocity.x);         float h = Input.GetAxisRaw("Horizontal");         //-1 0 1         if (h > 0) {             if (vel < maxVelocity)                 forceX = speed;            } else if (h < 0) {             if (vel < maxVelocity)                     forceX = -speed;         }          myBody.AddForce(new Vector2(forceX, 0 ));     }

Payer Script Calling the Movement Function void FixedUpdate () {         playerMoveKey();     } What’s the deference between FixedUpdate () and Update ()? Play the game and see the results Modify the speed and rigid body field

Payer Script adding animation to the player movement void playerMoveKey(){         float forceX = 0f;         float vel = Mathf.Abs (myBody.velocity.x);         float h = Input.GetAxisRaw("Horizontal");         if (h > 0) {             if (vel < maxVelocity)                 forceX = speed;             anim.SetBool ("Walk", true);         } else if (h < 0) {             if (vel < maxVelocity)                     forceX = -speed;             anim.SetBool ("Walk", true);         } else {             anim.SetBool ("Walk", false);         }         myBody.AddForce(new Vector2(forceX, 0 ));     }

Payer Script Facing the player to the right direction     void playerMoveKey(){         float forceX = 0f;         float vel = Mathf.Abs (myBody.velocity.x);         float h = Input.GetAxisRaw("Horizontal");         //-1 0 1         if (h > 0) {             if (vel < maxVelocity)                 forceX = speed;             Vector3 temp = transform.localScale;             temp.x = 1f;             transform.localScale = temp;             anim.SetBool ("Walk", true);         } else if (h < 0) {             if (vel < maxVelocity)                     forceX = -speed;             Vector3 temp = transform.localScale;             temp.x = -1f;             transform.localScale = temp;             anim.SetBool ("Walk", true);         } else {             anim.SetBool ("Walk", false);         }         myBody.AddForce(new Vector2(forceX, 0 ));     }

Assignment for next week Think of what’s the alternative for character movement ? Make your own game play with the current knowledge Create your own assets Install Blender Is it possible for creating the game in blender See if it’s possible or not