Game User Input Mouse Input.

Slides:



Advertisements
Similar presentations
CS0004: Introduction to Programming Select Case Statements and Selection Input.
Advertisements

Exploring Microsoft Access Chapter 8 Creating More Powerful Applications: Introduction to VBA By Robert T. Grauer Maryann Barber.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
Systems of Linear Equations
Graphing Linear Equations From the beginning. All the slides in this presentation are timed. You do not need to click the mouse or press any keys on the.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Chapter Introduction to Computers and Programming 1.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Solving Systems of Linear Equations
MATLAB File Management. MATLAB User File Management Matlab provides a group of commands to manage user files. For more information, type help iofun. pwd.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Microsoft Office Excel Copyright © 2008 Pearson Prentice Hall. All rights reserved
Prepared by Fareeha Lecturer DCS IIUI 1 Windows API.
Exploring Microsoft Access Chapter 8 Creating More Powerful Applications: Introduction to VBA.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Lesson 5 Introduction to HTML Forms. Lesson 5 Forms A form is an area that can contain form elements. Form elements are elements that allow the user to.
Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the.
Lecture Input Devices Keyboard. Mouse Microphone Digital Camera Scanner.
THE MOUSE Left Click THE MOUSE Right Click.
1.5 File Management.
Chapter 1: Introduction to Computers and Programming
An Interactive Tutorial for SPSS 10.0 for Windows©
Concepts of Engineering and Technology
BASIC PROGRAMMING C SCP1103 (02)
Systems of Linear Equations
Objective The student will be able to:
PYGAME.
Starting Out with Alice: A Visual Introduction to Programming
Keyboard Input.
BASIC PROGRAMMING C SCP1103 (02)
Graphing Linear Equations
Intro CS – Keyboard and mouse input
Intro & Point-to-Box, Circle-to-Circle, Point-to-Circle
Do Now Write down any math properties you know and give an example. (ex. Commutative) Write down any similarities or differences between expressions and.
Distributive Property Section 2.6
EMR field in Portals Work History page
Computer- Basics UNF team.
Introduction to Events
Explain what touch develop is to your students:
Systems of Linear Equations
Systems of Linear Equations
Iterations Programming Condition Controlled Loops (WHILE Loop)
Programming – Touch Sensors
Loopy Motion Control.
Systems of Linear Equations
Systems of Linear Equations
Meditation Class 1. Meditation Class 2. Meditation Class 3
Coding Concepts (Basics)
Introduction to TouchDevelop
Functions, Regular expressions and Events
Systems of Linear Equations
Data Groupings: File File: a group of related records
This presentation document has been prepared by Vault Intelligence Limited (“Vault") and is intended for off line demonstration, presentation and educational.
Lesson 2: Selecting Cells, Rows, and Columns
Library Search Procedure
Systems of Linear Equations
User Input Keyboard input.
The Distributive Property
JavaScript.
Processing Devices.
Explain what touch develop is to your students:
Game Programming Algorithms and Techniques
CS 1111 Introduction to Programming Spring 2019
Computer File Management Howard Weiss
Retrieving information from forms
This presentation document has been prepared by Vault Intelligence Limited (“Vault") and is intended for off line demonstration, presentation and educational.
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

Game User Input Mouse Input

Introduction Much like Keyboard Input, Mouse Input also serves as both a data entry and controller unit With a Mouse we are limited to detecting clicks and its location. However, this is all a mouse is truly designed for anyway.

Mouse Location We can retrieve the position of the Mouse at any point using the Input.GetMousePos() command. However, you must realize it returns a new data type called a Vector2F. This is simply an xy coordinate where each value is a float. Yes, it gives back both values in one variable. So when you wish to store the mouse’s location, you can either create two separate variables for each value, or you too can create a Vector2F variable: Vector2F mousePos = new Vector2F(0f,0f); //Set it to location 0,0 to start To retrieve the mouse coordinate then: mousePos.x = Input.GetMousePos().x; mousePos.y = Input.GetMousePos().y; As a side note, it is best to do this inside the check for a button click, as it can be an expensive task if done 60 times per second no matter what…

Mouse Click This is done in the same way as checking for a keyboard key 60 times per second, we use an if-statement: if (Input.IsMouseButtonReleased(Input.MOUSE_LEFT)) { //Check to see if the mouse clicked on something important } You can check for any of the three buttons: Input.MOUSE_LEFT Input.MOUSE_MID Input.MOUSE_RIGHT