+ All Categories
Home > Business > Chapt 3 role of actors

Chapt 3 role of actors

Date post: 13-Jan-2015
Category:
Upload: muhd-basheer
View: 114 times
Download: 0 times
Share this document with a friend
Description:
 
Popular Tags:
38
Chapter 3 Role of Actors mrbash.com| stencyl development 1
Transcript
Page 1: Chapt 3   role of actors

1

Chapter 3Role of Actors

mrbash.com| stencyl development

Page 2: Chapt 3   role of actors

2

Lesson Objectives

•Define the roles of actors in a game.Roles•State the elements of an actor.Elements•List the various input behavior controls used to control actors.Input Controls•Explain the different collision groups that actors are able to respond to.Collision groups

Page 3: Chapt 3   role of actors

3

Actors Actors are the “living” interactive part of a game.

Actors can be defined as any of the following,

Players Enemies Projectiles Vehicles Interface Elements

Page 4: Chapt 3   role of actors

4

Role of Actors1. Actors are the essential components of a game.

2. Actors increases the interactivity of a game.

3. Actors are the main focus of a game plot.

4. Actors gives uniqueness to gameplay.

Page 5: Chapt 3   role of actors

5

Elements of an ActorActors compromise of these 3 elements,

1. Appearance – How the actors look in a game.

2. Behaviour – How the actors behave/act in a game.

3. Physics – How the actors interact with the objects in the game and environment itself.

Page 6: Chapt 3   role of actors

6

Appearance (Animations)

The first look on an actor illustrates the outward appearance of an actor.

An animation is a group of frames form a visual lifelike motion representation of an actor.

Each actor may contain more than one animation.

Page 7: Chapt 3   role of actors

7

Appearance (Animation Examples)

Each animation may represent a different state that an actor take in a game.

Here are some examples of an animation state.

Page 8: Chapt 3   role of actors

8

Appearance (Animations)

An animation consists of 2 portions

1. Frames (How an animation looks like)

2. Collision Bounds (Its collision shape)

Page 9: Chapt 3   role of actors

9

Appearance (Frames in animation)

Frames are like pages of a sketchbook.

Each frame represents a different page.

When each page is flipped at quickly, these “pages” or frames form an animation.

Page 10: Chapt 3   role of actors

10

Appearance (Frames in animation)

For instance, an actor in a side scrolling game may contain 2 animations such as “walk left” and “walk right”.

For instance, in the “walk left” animation, it may contain 4 frames.

Each frame may represent both the left foot and right foot being stuck out the player actor walks to the left.

Page 11: Chapt 3   role of actors

11

Appearance (Frame Duration)

Each frame can be allocated a different duration.

Duration is measured in milliseconds (ms).

Minimum duration is 10ms.

Page 12: Chapt 3   role of actors

12

Appearance (Looping & Origin Point)

Each animation can be set to loop or play once.

An animation may have an assigned an origin point.

The origin point determines the rotation and scaling of an actor.

Page 13: Chapt 3   role of actors

13

Appearance(Collision Bounds)

An actor in a different animation/state may take on different states.

In this example, the player is standing has a wider surface area and takes on the shape of a rectangle.

The same player that is in a ducking position has a smaller surface area and takes on the shape of a circle.

Page 14: Chapt 3   role of actors

14

Actor BehavioursActor behaviours are defined by the way an actor acts in a game.

A behaviour defines the logic that is required for a specific action such as running, walking, jumping, shoot bullets and many more.

A behaviour can be attached to any actor.

Page 15: Chapt 3   role of actors

15

Input Controls behaviourAfter defining the appearance the actors, we need ways to control them on a computer or mobile platform. Here are some of the ways,

Keyboard (Controls)

Mouse

Mouse over Actor

Cursor

Page 16: Chapt 3   role of actors

16

Input Controls behaviour

Computer

Keyboard (Controls)

Mouse

Mouse over Actor

Cursor

Mobile

Accelerometer

Virtual-Joystick

Multi-Touch

Page 17: Chapt 3   role of actors

17

Computer Controls(Keyboard)

Actor responds to a keyboard key press.

When a key press is made, an assigned action will be carried out.

For example, when the “arrow up” button is pressed, the actor may be assigned to jump.

Page 18: Chapt 3   role of actors

18

Computer Controls(Mouse)

Actor responds to a mouse click.

When the mouse is clicked, an assigned action will be carried out.

For example, when the “left click” button is clicked, the actor may be assigned to shoot in instances like FPS (First Person Shooter) games.

Page 19: Chapt 3   role of actors

19

Computer Controls(Mouse States)

A mouse event in sensed in 3 states.

1. Pressed (happen once)

2. Released (happen once)

3. Down (constant state when held down)

Take for example the firing of a gun.

4. Pressed (Manual firing)

5. Down (Automatic firing)

Page 20: Chapt 3   role of actors

20

Computer Controls(Mouse over Actor)

A mouse over event in sensed in 4 states.

1. Pressed on Actor.

2. Released on Actor.

3. Down on Actor.

4. Over Actor.

Page 21: Chapt 3   role of actors

21

Computer Controls(The cursor)

A cursor event in used to show or hide the cursor in different instances.

Not always used.

Page 22: Chapt 3   role of actors

22

Mobile Controls

In Stencyl 3, a mouse input event is treated the same as a touch event on the mobile screen.

No separate blocks are required for both of these events.

Page 23: Chapt 3   role of actors

23

Mobile Controls(Accelerometer)

Some games require a user control to tilt the device the device.

Example of games on the iOS that require tilt action are “Into the dead” and “Tilt Racing”.

Page 24: Chapt 3   role of actors

24

Mobile Controls(Accelerometer values)

Accelerometer design blocks can be found under the User Input > Mobile category in the instruction palette.

Values are measured in 3 directions.

1. X of accelerometer

2. Y of accelerometer

3. Z of accelerometer

Page 25: Chapt 3   role of actors

25

Mobile Controls(Accelerometer values)

Accelerometer values range from -1.0 to 1.0

An example of ,Y = 1 would mean user is tilting extremely to the top.

Page 26: Chapt 3   role of actors

26

Mobile Controls(Accelerometer values)PORTRAIT ORIENTATION

X (Positive) = Right

X (Negative) = Left

Y (Positive) = Up

Y (Negative) = Down

LANDSCAPE ORIENTATION

X (Positive) = Up

X (Negative) = Down

Y (Positive) = Left

Y (Negative) = Right

Page 27: Chapt 3   role of actors

27

Mobile Controls(Joystick)

Some games require a user to precisely control an actor freely.

Movement ranges from 0 to 360 degrees.

Used as input to move characters in game by holding on to desired direction.

Page 28: Chapt 3   role of actors

28

Mobile Controls(Enabling Joystick)

3 block of codes associated with enabling joystick,

1.Enable joystick

2.Joystick direction (0 to 360 degrees)

3.Joystick distance (how far user has held on to direction controls from origin)

Page 29: Chapt 3   role of actors

29

Mobile Controls(Joystick Configuration)

Click on game "Settings“

Under mobile, click on joystick.

Joystick appearance and joystick can be customised here.

Page 30: Chapt 3   role of actors

30

Mobile Controls(Multi-touch)

Not all games require single touch.

Some games require multi-touch as game inputs.

Multi-touch events are used to handle multi-touch instances.

Page 31: Chapt 3   role of actors

31

PhysicsThe physics in games is very much similar to that of the real world.

An example of that would be gravity. In a game, we can tweak physics to the parameters that we want.

We can choose to have gravity for a Mario like game or negate the gravity to have a space ship float in a space invaders game.

Page 32: Chapt 3   role of actors

32

Physics(General tab)

Cannot Move: The actor cannot move or be moved, thus, becoming stationary.

Cannot Be Pushed: The actor can move but cannot be moved by another actor.

Normal: The Actor can move on its own and be moved by other Actors.

Page 33: Chapt 3   role of actors

33

Physics(General tab)

Can Rotate?

Determines whether or not your actor can rotate.

Rotation happens either naturally through physics, setting the turning speed or twisting it with some force.

Page 34: Chapt 3   role of actors

34

Physics(General tab)

Affected by Gravity?

Gravity is a constant force that affects all bodies within a scene.

Gravity can be set to any direction and magnitude (strength) via the Physics page of a Scene. Gravity does not always point down.

You can set an Actor to obey or ignore gravity.

Page 35: Chapt 3   role of actors

35

Actor Collision GroupsGroups are basically collection of actors

Default groups exist such as players, enemies and tiles.

Groups can be created for almost any categories of actors

Players Enemies Tiles

Page 36: Chapt 3   role of actors

36

Actor Collision GroupsOften a times, actors collide within each other in a game environment.

For instance, when a car crashes into a tree, the point when the car hits makes contact with the tree is known as a collision.

The collision takes place between both the bullet and enemy actors.

Page 37: Chapt 3   role of actors

37

Actor Collision Groups(Setting up groups)

Click on game "Settings“

Click on groups.

Page 38: Chapt 3   role of actors

38

Questions?


Recommended