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

Game Programming Step-22 Learn Control Enemy walk into Game .

Dec 24, 2015

Download

Documents

Alan Mosley
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Game Programming Step-22 Learn Control Enemy walk into Game .

Game Programming Step-22

Learn Control Enemy walk into Game

http://www.prasansoft.com

Page 2: Game Programming Step-22 Learn Control Enemy walk into Game .

Purpose Step 22

• Learn Control Enemy walk into Game

http://www.prasansoft.com

Page 3: Game Programming Step-22 Learn Control Enemy walk into Game .

Components folder in Step-22

http://www.prasansoft.com

Page 4: Game Programming Step-22 Learn Control Enemy walk into Game .

Write command follow line198-211

http://www.prasansoft.com

Page 5: Game Programming Step-22 Learn Control Enemy walk into Game .

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

Page 6: Game Programming Step-22 Learn Control Enemy walk into Game .

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

Page 7: Game Programming Step-22 Learn Control Enemy walk into Game .

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

Page 8: Game Programming Step-22 Learn Control Enemy walk into Game .

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

Page 9: Game Programming Step-22 Learn Control Enemy walk into Game .

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

Page 10: Game Programming Step-22 Learn Control Enemy walk into Game .

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

Page 11: Game Programming Step-22 Learn Control Enemy walk into Game .

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

Page 12: Game Programming Step-22 Learn Control Enemy walk into Game .

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

Page 13: Game Programming Step-22 Learn Control Enemy walk into Game .

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

Page 14: Game Programming Step-22 Learn Control Enemy walk into Game .

Write command follow line215-222

http://www.prasansoft.com

Page 15: Game Programming Step-22 Learn Control Enemy walk into Game .

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

Page 16: Game Programming Step-22 Learn Control Enemy walk into Game .

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

Page 17: Game Programming Step-22 Learn Control Enemy walk into Game .

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

Page 18: Game Programming Step-22 Learn Control Enemy walk into Game .

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

Page 19: Game Programming Step-22 Learn Control Enemy walk into Game .

Result Step-22

http://www.prasansoft.com