game programming step-22 learn control enemy walk into game

19
Game Programming Step- 22 Learn Control Enemy walk into Game http:// www.prasansoft.com

Upload: alan-mosley

Post on 24-Dec-2015

220 views

Category:

Documents


1 download

TRANSCRIPT

Game Programming Step-22

Learn Control Enemy walk into Game

http://www.prasansoft.com

Purpose Step 22

• Learn Control Enemy walk into Game

http://www.prasansoft.com

Components folder in Step-22

http://www.prasansoft.com

Write command follow line198-211

http://www.prasansoft.com

CAMERA POSITION X This command will return the real value X position of the camera in 3D space.

• Syntax • Return Float=CAMERA POSITION X()• Return Float=CAMERA POSITION X(Camera Number)

• Example• PLAYER_X#=CAMERA POSITION X(0)

http://www.prasansoft.com

CAMERA POSITION Y This command will return the real value Y position of the camera in 3D space.

• Syntax • Return Float=CAMERA POSITION Y()• Return Float=CAMERA POSITION Y(Camera Number)

• Example• PLAYER_Y#=CAMERA POSITION Y(0)

http://www.prasansoft.com

CAMERA POSITION Z This command will return the real value Z position of the camera in 3D space.

• Syntax • Return Float=CAMERA POSITION Z()• Return Float=CAMERA POSITION Z(Camera Number)

• Example• PLAYER_Z#=CAMERA POSITION Z(0)

http://www.prasansoft.com

GET GROUND HEIGHT

This command will calculate and return the Y coordinate within the matrix given

the X and Z coordinates. This command can be used to allows 3D objects to traverse

the contours of any matrix landscape with ease.

The matrix number should be an integer value.

• Syntax • Return Float=GET GROUND HEIGHT(Matrix Number, X, Z)

• Example• PLAYER_H#=GET GROUND HEIGHT(1,PLAYER_X#,PLAYER_Z#)

http://www.prasansoft.com

POSITION CAMERA This command will set the position of the camera in 3D space.

The coordinates should be real numbers.

• Syntax • POSITION CAMERA X, Y, Z• POSITION CAMERA Camera Number, X, Y, Z• POSITION CAMERA Camera Number, Vector

• Example• POSITION CAMERA 0,PLAYER_X#,180+PLAYER_H#,PLAYER_Z#

http://www.prasansoft.com

POSITION CAMERA This command will set the position of the camera in 3D space.

The coordinates should be real numbers.

• Syntax • POSITION CAMERA X, Y, Z• POSITION CAMERA Camera Number, X, Y, Z• POSITION CAMERA Camera Number, Vector

• Example• POSITION CAMERA 0,PLAYER_X#,180+PLAYER_H#,PLAYER_Z#

http://www.prasansoft.com

OBJECT POSITION X This command will return a real value X position of the specified 3D object in 3D space.

The parameter should be specified using an integer value.

• Syntax • Return Float=OBJECT POSITION X(Object Number)

• Example• SATAN_X#=OBJECT POSITION X(SATAN1)

http://www.prasansoft.com

OBJECT POSITION Y This command will return a real value Y position of the specified 3D object in 3D space.

The parameter should be specified using an integer value.

• Syntax • Return Float=OBJECT POSITION Y(Object Number)

• Example• SATAN_Y#=OBJECT POSITION Y(SATAN1)

http://www.prasansoft.com

OBJECT POSITION Z This command will return a real value Z position of the specified 3D object in 3D space.

The parameter should be specified using an integer value.

• Syntax • Return Float=OBJECT POSITION Z(Object Number)

• Example• SATAN_Z#=OBJECT POSITION Z(SATAN1)

http://www.prasansoft.com

Write command follow line215-222

http://www.prasansoft.com

SQRT

This command will return the square root of a value.

The value can be an integer or real number.

The return value will be a real number.

• Syntax • Return Float=SQRT(Value)

• Example• RANGE#=SQRT((PLAYER_X#-SATAN_X#)^2+(PLAYER_Y#SATAN_Y#)^2• +(PLAYER_Z#-SATAN_Z#)^2)

http://www.prasansoft.com

LOOP OBJECT

This command will play and loop the animation data contained within

the specified 3D object from the beginning. You can optionally play and loop

the animation by providing a specified start and end frame.

• Syntax • LOOP OBJECT Object Number• LOOP OBJECT Object Number, Start Frame• LOOP OBJECT Object Number, Start Frame, End Frame

• Example

• LOOP OBJECT SATAN1,5,25

http://www.prasansoft.com

POINT OBJECT

This command will point the specified 3D object towards a point in 3D space.

The command sets the current direction of the object to face towards

this point in space. The object number should be specified using an integer value.

• Syntax • POINT OBJECT Object Number, X, Y, Z

• Example• POINT OBJECT SATAN1,PLAYER_X#,SATAN_Y#,PLAYER_Z#

http://www.prasansoft.com

MOVE OBJECT

This command will move the specified 3D object in 3D space.

The command uses the current direction of the object and moves

it using the specified step value. In order to see your 3D object,

• Syntax • MOVE OBJECT Object Number, Speed

• Example• MOVE OBJECT SATAN1,3

http://www.prasansoft.com

Result Step-22

http://www.prasansoft.com