chapt 5 behaviors and attributes

22
Chapter 5 Behaviors & Attributes mrbash.com| stencyl development 1

Upload: muhd-basheer

Post on 28-Nov-2014

121 views

Category:

Entertainment & Humor


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Chapt 5   behaviors and attributes

1

Chapter 5Behaviors & Attributes

mrbash.com| stencyl development

Page 2: Chapt 5   behaviors and attributes

2

Lesson Objectives

•Explain the definition of game behaviors.Behaviors•Explain the usage of events within a behavior.Events•Identify the differences between an actor and a scene behavior.Differences•Explain the usage of attributes and game attributes within a game behavior.Attributes

Page 3: Chapt 5   behaviors and attributes

3

Game Behaviour A game is not simply defined by just adding actors and putting them in a scene.

There is a need for interactive gameplay to make a game engaging and meaningful.

Behaviours add this interactivity to a game.

Page 4: Chapt 5   behaviors and attributes

4

Game Behaviour Stencyl’s behaviour designer contain snippets of logic to form behaviours.

These behaviours can be attached to actors and scenes.

The core of the game play pretty much revolves around the behaviours.

Page 5: Chapt 5   behaviors and attributes

5

Game Behaviour A behaviour is “reusable”, “configurable” and “attachable” to an actor or scene.

Behaviours are the abilities that an actor or scene possesses.

A “jump and run movement” is an example of an actor behaviour.

Page 6: Chapt 5   behaviors and attributes

6

Game Behaviour(Attaching Behaviours)

Attaching a behaviour is easy.

Open an existing actor or scene.

Click the “behaviour” tab.

Page 7: Chapt 5   behaviors and attributes

7

Game Behaviour(Attaching Behaviours)

Click the “Add Behaviour” tab.

Search for the desired behaviour.

Click “Choose”.

Repeat the steps for other desired behaviours.

Page 8: Chapt 5   behaviors and attributes

8

Game Behaviour(Configuring Behaviours)

Once the behaviour is attached, its parameters can be configured.

Parameters or attributes are customizable according to the pre-defined behaviour.

As for the “Jump and Run Movement” behaviour, attributes such as jump force and run speed can be assigned different values as preferred.

Page 9: Chapt 5   behaviors and attributes

9

Game Behaviour(Examining Behaviours)

Click “Edit Behaviour”.

The panel on the left indicates the events section.

The grey workspace on the right include the snippets of codes that fall within a particular event.

Page 10: Chapt 5   behaviors and attributes

10

Game Behaviour(Events)

An event indicates an action or occurrence that has taken place in a game.

When an event takes place, it triggers a response.

This “event and response” can also be known as the “cause and effect”.

Page 11: Chapt 5   behaviors and attributes

11

Game Behaviour(Actor vs Scene)

Behaviours

Actor type Scene type

Attached to an actor for example,

“Fire bullet”

Attached to a scene for example,

“Background Music”

Page 12: Chapt 5   behaviors and attributes

12

Game Behaviour(Categories)

Behaviours

Pre-shipped StencylForge Custom

Default behaviours available upon

creation of game.

Behaviours developed by

community and uploaded to

resource marketplace.

Custom made behaviours using snippets of logic blocks from the

instruction pallete.

Page 13: Chapt 5   behaviors and attributes

13

AttributesAttributes

Behaviour Attributes Game Attributes

Attributes that is local within a

behaviour.

Attributes that is local within the

entire game

Page 14: Chapt 5   behaviors and attributes

14

Behaviour AttributesMost games need to keep track of information of values such as score.

These values are called attributes.

Attributes are changeable values within a behaviour and come in different formats.

Page 15: Chapt 5   behaviors and attributes

15

Behaviour AttributesAttributes are easily understood from the following example:

A person possesses certain attributes such as the following.

Name of attribute

Type Example

name Text “John”

age Number “16”

height Number “170”

Page 16: Chapt 5   behaviors and attributes

16

Behaviour AttributesLikewise, in a Stencyl behaviour, it may contain similar attributes.

A behaviour “random enemy spawn” may contain attributes such as the following.

Name of attribute Type

villain actor

randomNumber Number

checkHitEnemy Boolean (True of False)

Page 17: Chapt 5   behaviors and attributes

17

Behaviour Attributes(Attribute Types)

A behaviour attribute is categorised into 16 different types.

Each of these values can be changed and customised.

Attributes can also be made hidden or visible.

Page 18: Chapt 5   behaviors and attributes

18

Behaviour Attributes(Changeable)

Behaviour attributes are assigned default values at start.

Values can be changed during 2 instances,

1. At the start of assigning values when creating the attribute.

2. In the midst of the game

Attributes are changeable from the point of view of the behaviour designer.

Page 19: Chapt 5   behaviors and attributes

19

Behaviour Attributes(Customizable)

Attributes can be made exposed for other developers to perform customization.

Take for example, an attribute “Bullet Speed” within the behaviour “Fire bullet.”

Change the value of “Bullet Speed” from 25 to 50 and now the bullet is being shot at twice the speed.

Page 20: Chapt 5   behaviors and attributes

20

Game AttributesA game attribute is similar to a behaviour attribute.

The exception is that game attributes persists throughout the game rather than being local in just a behaviour.

Game attributes and also changeable and customisable.

Page 21: Chapt 5   behaviors and attributes

21

Game Attributes(Attribute Types)

A game attribute is categorised into 4 different types.

1. Number2. Text3. Boolean (Yes or No)4. List

Page 22: Chapt 5   behaviors and attributes

22

Questions?