Chapt 5 behaviors and attributes

Post on 28-Nov-2014

115 views 1 download

description

 

transcript

1

Chapter 5Behaviors & Attributes

mrbash.com| stencyl development

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

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.

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.

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.

6

Game Behaviour(Attaching Behaviours)

Attaching a behaviour is easy.

Open an existing actor or scene.

Click the “behaviour” tab.

7

Game Behaviour(Attaching Behaviours)

Click the “Add Behaviour” tab.

Search for the desired behaviour.

Click “Choose”.

Repeat the steps for other desired behaviours.

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.

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.

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”.

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”

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.

13

AttributesAttributes

Behaviour Attributes Game Attributes

Attributes that is local within a

behaviour.

Attributes that is local within the

entire game

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.

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”

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)

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.

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.

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.

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.

21

Game Attributes(Attribute Types)

A game attribute is categorised into 4 different types.

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

22

Questions?