UFCEKU-20-3Web Games Programming Shockwave 3D Environment and Lingo Scripting Basics.

16
UFCEKU-20-3 Web Games Programming Web Games Programming Shockwave 3D Environment and Lingo Scripting Basics
  • date post

    19-Dec-2015
  • Category

    Documents

  • view

    215
  • download

    2

Transcript of UFCEKU-20-3Web Games Programming Shockwave 3D Environment and Lingo Scripting Basics.

Page 1: UFCEKU-20-3Web Games Programming Shockwave 3D Environment and Lingo Scripting Basics.

UFCEKU-20-3Web Games Programming

Web Games Programming

Shockwave 3D Environment and Lingo Scripting Basics

Page 2: UFCEKU-20-3Web Games Programming Shockwave 3D Environment and Lingo Scripting Basics.

UFCEKU-20-3Web Games Programming

Agenda

Shockwave 3D Coordinate System Basics of Shockwave Cameras and Lights Lingo Scripting Review Getting Started Tutorial Overview of 3D World Tutorial Activites

Page 3: UFCEKU-20-3Web Games Programming Shockwave 3D Environment and Lingo Scripting Basics.

UFCEKU-20-3Web Games Programming

Director 3D Coordinate System

zx

+

-

+

-

Eye point

y

+

-

Page 4: UFCEKU-20-3Web Games Programming Shockwave 3D Environment and Lingo Scripting Basics.

UFCEKU-20-3Web Games Programming

Shockwave Cameras

Always in focus No given depth of field No aberrations e.g lens flare Could create some of effects when required but resource intensive

Page 5: UFCEKU-20-3Web Games Programming Shockwave 3D Environment and Lingo Scripting Basics.

UFCEKU-20-3Web Games Programming

3D Viewing Frustrum

Page 6: UFCEKU-20-3Web Games Programming Shockwave 3D Environment and Lingo Scripting Basics.

UFCEKU-20-3Web Games Programming

Clipping Planes

Page 7: UFCEKU-20-3Web Games Programming Shockwave 3D Environment and Lingo Scripting Basics.

UFCEKU-20-3Web Games Programming

Camera Attributes

transform (rotate and translate) projection (orthographic or perspective) fieldofview ( a value > 0 and < 180) orthoheight ( value > 0) hither (near clipping plane) yon (far clipping plane) background colour (rgb value)

Page 8: UFCEKU-20-3Web Games Programming Shockwave 3D Environment and Lingo Scripting Basics.

UFCEKU-20-3Web Games Programming

Camera Attributes Default camera is referenced as camera 1 Scene.camera[1].translate(0,70,0) (move in y plane) Scene.camera[1].rotate(-15,0,0) (rotate about x axis) Scene.camera[1].fieldofview = 22 (set lens angle) New cameras can be named on creation:

--create new camera called closeup scene.newcamera(“closeup”) --position camera scene.camera(“closeup”).translate(100,200,75) --rotate camera scene.camera(“closeup”).rotate(-10,0,0) --set field of view scene.camera(“closeup”).fieldofview = 11

Page 9: UFCEKU-20-3Web Games Programming Shockwave 3D Environment and Lingo Scripting Basics.

UFCEKU-20-3Web Games Programming

Creating Lights

Light Types - Point, Directional, Spot,

General syntax

member(“castmember”).newLight(“name”,#type)

Example

member(”spotlightOne”).newLight(“spotOne”, #spotlight)

Page 10: UFCEKU-20-3Web Games Programming Shockwave 3D Environment and Lingo Scripting Basics.

UFCEKU-20-3Web Games Programming

Light Node AttributesProperty Light Type Value FormatColor All rgb(R,G,B)

Rotation #directional, #spot vector(x,y,z)

Position #point, #spot vector(x,y,z)

Specular #directional, #point,#spot true or false

Spotangle #spot 0-90

Spotdecay #spot true or false

Attentuation #point, #spot vector(C,L,Q)constant, linear, quadratic - default is (1,0,0)

Page 11: UFCEKU-20-3Web Games Programming Shockwave 3D Environment and Lingo Scripting Basics.

UFCEKU-20-3Web Games Programming

Spot Light Attributes

Intensity - how much light emitted from the source light

Decay - how much light diminishes away from the source light (fall -off)

Cone Angle - width of the lights cone of influence - area outside cone not

illuminated

Penumbra Angle - fall off at edge of cone angle - more gives a softer

edge to the light cone

Drop-off - how much the light diminishes at the outer edges

Colour - set an RGB colour for the light - affects colour of scene

Page 12: UFCEKU-20-3Web Games Programming Shockwave 3D Environment and Lingo Scripting Basics.

UFCEKU-20-3Web Games Programming

Lingo

The Lingo scripting language features the usual facilities for declaring Variables of a given type and controlling logic via loops and branches.

Syntax (structure) , Keywords (reserved), variables, typesint, float, string, if .. then, repeat while

comments need to preceded by ---- this is a commentUse the message window to evaluate Lingo code immediately via the put statement

type in message windowput 14 + 519

Page 13: UFCEKU-20-3Web Games Programming Shockwave 3D Environment and Lingo Scripting Basics.

UFCEKU-20-3Web Games Programming

Lingo Scripts Types

Movie scripts - global across entire movie Behaviour (sprite) scripts - associated with an instance of a

sprite or frame in the Score - active at given frame or frames to which assigned

Parent scripts are special scripts that contain Lingo that is used to create child objects. You can use parent scripts to generate script objects that behave and respond similarly yet can still operate independently of each other.

Object scripts which hold properties and methods (handlers)

Page 14: UFCEKU-20-3Web Games Programming Shockwave 3D Environment and Lingo Scripting Basics.

UFCEKU-20-3Web Games Programming

Lingo Handlers

Director implements the event -driven programming model Lingo refers to what other programming environments call

functions or methods ‘handlers’ Use Lingo handlers (function, method) to ‘handle’ the event

-- mouseDown event handleron mouseDown

beepend

Page 15: UFCEKU-20-3Web Games Programming Shockwave 3D Environment and Lingo Scripting Basics.

UFCEKU-20-3Web Games Programming

Lingo compared to other OOP Languages

OOP Term Lingo Equivalent

Base Class Ancestor ScriptClass Parent ScriptInstance Variable Property VariableClass Instance/Object Child ObjectMethod / Member Function Method

Event Listener Handler

Page 16: UFCEKU-20-3Web Games Programming Shockwave 3D Environment and Lingo Scripting Basics.

UFCEKU-20-3Web Games Programming

Lingo API

Lingo has an extensive API for all aspects of multimedia development.

Shockwave 3D has its own additional API for development of 3Dnavigable interactive environments which can be deployed on the web.