Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Global NextStageDest$
- Function Object_Goal_Create.tObject(x#, y#, z#,rx#=0, ry#=0, rz#=0,Dest$,sx#,sy#,sz#)
- o.tObject = New tObject
- o\ObjType = OBJTYPE_GOAL
- o\Position = New tVector
- o\Position\x# = x#
- o\Position\y# = y#
- o\Position\z# = z#
- o\Rotation = New tVector
- o\Rotation\x# = rx#
- o\Rotation\y# = ry#
- o\Rotation\z# = rz#
- o\Dest$ = Dest$
- o\ObjectCanHoming=False
- o\Scale=New tVector
- o\Scale\x# = sx#
- o\Scale\y# = sy#
- o\Scale\z# = sz#
- o\Entity = LoadMesh("Objects\no.b3d")
- If (LinePick(x#, y#, z#, 0, -OMEGA#, 0)<>0) Then
- o\IValues[0] = CreateQuad(3, 1.1, 1.5, 0.5)
- EntityTexture(o\IValues[0], Textures_Shadow)
- PositionEntity(o\IValues[0], PickedX#(), PickedY#(), PickedZ#(), True)
- o\FValues[0] = PickedNX#()
- o\FValues[1] = PickedNY#()
- o\FValues[2] = PickedNZ#()
- MoveEntity(o\IValues[0], 0, 0.2, 0)
- ScaleEntity(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1))
- EntityAlpha(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1))
- End If
- ScaleEntity o\Entity,1.2, 1, 1.2
- TranslateEntity o\Entity, x#, y#, z#
- TurnEntity o\Entity, rx#, ry#, rz#
- Pivot = CreateCube()
- PositionEntity(Pivot, x#, y#, z#)
- ScaleEntity pivot,sx#,sy#,sz#
- EntityAlpha pivot, 0.5
- ;TurnEntity pivot,0,ry#+90,rz#
- EntityColor Pivot, 255,0,0
- Return o
- End Function
- ; =========================================================================================================
- ; Object_Goal_Update
- ; =========================================================================================================
- ; Updates the goal object
- Function Object_Goal_Update(o.tObject, p.tPlayer, d.tDeltaTime)
- ;New code To check the state of the ring
- If (o\State=0) Then
- ; Player collided with ring
- If (Abs(EntityX(p\Objects\Entity) - o\Position\x) < o\Scale\x) And (Abs(EntityY(p\Objects\Entity) - o\Position\y) < o\Scale\y) And (Abs(EntityZ(p\Objects\Entity) - o\Position\z) < o\Scale\z) Then
- ; Bling!
- StopChannel (Channel_Music)
- StopChannel (Channel_BoostMusic)
- StageRestart()
- normaldest$ = o\Dest$
- switchstage=True
- Return
- EndIf
- EndIf
- End Function
- ; =========================================================================================================
- ; Object_Invis_Create
- ; =========================================================================================================
- ; Creates a New Goalinvis Object
- Global testdest$
- Global Switchstage=False
- Global Normaldest$
- Function Object_GoalInvis_Create.tObject(x#, y#, z#,rx#=0, ry#=0, rz#=0,Dest$,sx#,sy#,sz#)
- o.tObject = New tObject
- o\ObjType = OBJTYPE_GOALINVIS
- o\Position = New tVector
- o\Position\x# = x#
- o\Position\y# = y#
- o\Position\z# = z#
- o\Rotation = New tVector
- o\Rotation\x# = rx#
- o\Rotation\y# = ry#
- o\Rotation\z# = rz#
- o\Dest$ = Dest$
- o\ObjectCanHoming=False
- o\Scale=New tVector
- o\Scale\x# = sx#
- o\Scale\y# = sy#
- o\Scale\z# = sz#
- o\Entity = LoadMesh("Objects\no.b3d")
- If (LinePick(x#, y#, z#, 0, -OMEGA#, 0)<>0) Then
- o\IValues[0] = CreateQuad(3, 1.1, 1.5, 0.5)
- EntityTexture(o\IValues[0], Textures_Shadow)
- PositionEntity(o\IValues[0], PickedX#(), PickedY#(), PickedZ#(), True)
- o\FValues[0] = PickedNX#()
- o\FValues[1] = PickedNY#()
- o\FValues[2] = PickedNZ#()
- MoveEntity(o\IValues[0], 0, 0.2, 0)
- ScaleEntity(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1))
- EntityAlpha(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1))
- End If
- ScaleEntity o\Entity,1.2, 1, 1.2
- TranslateEntity o\Entity, x#, y#, z#
- TurnEntity o\Entity, rx#, ry#, rz#
- Pivot = CreateCube()
- PositionEntity(Pivot, x#, y#, z#)
- ScaleEntity pivot,sx#,sy#,sz#
- EntityAlpha pivot, 0.5
- ;TurnEntity pivot,0,ry#+90,rz#
- EntityColor Pivot, 255,0,0
- Return o
- End Function
- ; =========================================================================================================
- ; Object_Goalinvis_Update
- ; =========================================================================================================
- ; Updates the goalinvis object
- Function Object_GoalInvis_Update(o.tObject, p.tPlayer, d.tDeltaTime)
- ;New code To check the state of the ring
- If (o\State=0) Then
- ; Player collided with ring
- If (Abs(EntityX(p\Objects\Entity) - o\Position\x) < o\Scale\x) And (Abs(EntityY(p\Objects\Entity) - o\Position\y) < o\Scale\y) And (Abs(EntityZ(p\Objects\Entity) - o\Position\z) < o\Scale\z) Then
- ; Bling!
- StopChannel (Channel_Music)
- StopChannel (Channel_BoostMusic)
- testdest$ = o\Dest$
- switchstage=True
- StageRestart()
- Return
- EndIf
- EndIf
- End Function
- ; /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
- ; Checkpoint
- ; /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
- ; =========================================================================================================
- ; Object_Checkpoint_Create
- ; =========================================================================================================
- ; Creates a New Ring Object
- Function Object_Checkpoint_Create.tObject(x#, y#, z#,rx#=0, ry#=0, rz#=0)
- o.tObject = New tObject
- o\ObjType = OBJTYPE_CP
- o\Position = New tVector
- o\Position\x# = x#
- o\Position\y# = y#
- o\Position\z# = z#
- o\Rotation = New tVector
- o\Rotation\x# = rx#
- o\Rotation\y# = ry#
- o\Rotation\z# = rz#
- o\Entity = CopyEntity(Check1_Model)
- o\EntityAnimation = CopyEntity(Check2_Model)
- EntityAutoFade(o\Entity, OBJECT_VIEWDISTANCE_MIN#, OBJECT_VIEWDISTANCE_MAX#)
- ScaleEntity o\Entity, 0.6, 0.6, 0.6
- TranslateEntity o\Entity, x#, y#, z#
- EntityAutoFade(o\EntityAnimation , OBJECT_VIEWDISTANCE_MIN#, OBJECT_VIEWDISTANCE_MAX#)
- ScaleEntity o\EntityAnimation , 0.6, 0.6, 0.6
- TranslateEntity o\EntityAnimation , x#, y#, z#
- TurnEntity o\Entity, rx#, ry#, rz#
- TurnEntity o\EntityAnimation, rx#, ry#, rz#
- Return o
- End Function
- Global Checkpoint_Activate = False
- Global CheckpointIdle =0
- Global Spawn_X
- Global Spawn_Y
- Global Spawn_Z
- Global Spawn_rot_X
- Global Spawn_rot_Y
- Global Spawn_rot_Z
- Global CheckTime
- ; =========================================================================================================
- ; Object_Checkpoint_Update
- ; =========================================================================================================
- ; Updates the ring object
- Function Object_Checkpoint_Update(o.tObject, p.tPlayer, d.tDeltaTime)
- ; Aaron's optimization -- get the distance only once
- dist# = EntityDistance(p\Objects\Entity, o\Entity)
- ; Check to see if the entity is within a good range for activation
- If dist > 0 And dist < 5
- ; Check to see if the entity has already been activated
- If o\State > 0 And o\State < 2
- ; NOTE: You could play a "this checkpoint is not active" sound here
- ; Return because the entity has already been activated
- Return
- EndIf
- ; NOTE: This area will NOT be reached if the entity was activated
- ; Record that this entity has been activated
- o\State = 1
- ; Begin the activation effect
- Checked = True
- PlaySound Sound_Checkpoint
- Animate o\EntityAnimation, 3, 0.75
- Spawn_X = EntityX(p\Objects\Entity)
- Spawn_Y = EntityY(p\Objects\Entity) +1
- Spawn_Z = EntityZ(p\Objects\Entity)
- Spawn_rot_X =-o\Rotation\x#
- Spawn_rot_Y =-o\Rotation\y#
- Spawn_rot_Z =-o\Rotation\z#
- CheckTime = Game\Gameplay\Time
- Return
- EndIf
- End Function
- Global NextStageDest$
- Function Object_Goal_Create.tObject(x#, y#, z#,rx#=0, ry#=0, rz#=0,Dest$,sx#,sy#,sz#)
- o.tObject = New tObject
- o\ObjType = OBJTYPE_GOAL
- o\Position = New tVector
- o\Position\x# = x#
- o\Position\y# = y#
- o\Position\z# = z#
- o\Rotation = New tVector
- o\Rotation\x# = rx#
- o\Rotation\y# = ry#
- o\Rotation\z# = rz#
- o\Dest$ = Dest$
- o\ObjectCanHoming=False
- o\Scale=New tVector
- o\Scale\x# = sx#
- o\Scale\y# = sy#
- o\Scale\z# = sz#
- o\Entity = LoadMesh("Objects\no.b3d")
- If (LinePick(x#, y#, z#, 0, -OMEGA#, 0)<>0) Then
- o\IValues[0] = CreateQuad(3, 1.1, 1.5, 0.5)
- EntityTexture(o\IValues[0], Textures_Shadow)
- PositionEntity(o\IValues[0], PickedX#(), PickedY#(), PickedZ#(), True)
- o\FValues[0] = PickedNX#()
- o\FValues[1] = PickedNY#()
- o\FValues[2] = PickedNZ#()
- MoveEntity(o\IValues[0], 0, 0.2, 0)
- ScaleEntity(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1))
- EntityAlpha(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1))
- End If
- ScaleEntity o\Entity,1.2, 1, 1.2
- TranslateEntity o\Entity, x#, y#, z#
- TurnEntity o\Entity, rx#, ry#, rz#
- Pivot = CreateCube()
- PositionEntity(Pivot, x#, y#, z#)
- ScaleEntity pivot,sx#,sy#,sz#
- EntityAlpha pivot, 0.5
- ;TurnEntity pivot,0,ry#+90,rz#
- EntityColor Pivot, 255,0,0
- Return o
- End Function
- ; =========================================================================================================
- ; Object_Goal_Update
- ; =========================================================================================================
- ; Updates the goal object
- Function Object_Goal_Update(o.tObject, p.tPlayer, d.tDeltaTime)
- ;New code To check the state of the ring
- If (o\State=0) Then
- ; Player collided with ring
- If (Abs(EntityX(p\Objects\Entity) - o\Position\x) < o\Scale\x) And (Abs(EntityY(p\Objects\Entity) - o\Position\y) < o\Scale\y) And (Abs(EntityZ(p\Objects\Entity) - o\Position\z) < o\Scale\z) Then
- ; Bling!
- StopChannel (Channel_Music)
- StopChannel (Channel_BoostMusic)
- StageRestart()
- normaldest$ = o\Dest$
- switchstage=True
- Return
- EndIf
- EndIf
- End Function
- ; =========================================================================================================
- ; Object_Invis_Create
- ; =========================================================================================================
- ; Creates a New Goalinvis Object
- Global testdest$
- Global Switchstage=False
- Global Normaldest$
- Function Object_GoalInvis_Create.tObject(x#, y#, z#,rx#=0, ry#=0, rz#=0,Dest$,sx#,sy#,sz#)
- o.tObject = New tObject
- o\ObjType = OBJTYPE_GOALINVIS
- o\Position = New tVector
- o\Position\x# = x#
- o\Position\y# = y#
- o\Position\z# = z#
- o\Rotation = New tVector
- o\Rotation\x# = rx#
- o\Rotation\y# = ry#
- o\Rotation\z# = rz#
- o\Dest$ = Dest$
- o\ObjectCanHoming=False
- o\Scale=New tVector
- o\Scale\x# = sx#
- o\Scale\y# = sy#
- o\Scale\z# = sz#
- o\Entity = LoadMesh("Objects\no.b3d")
- If (LinePick(x#, y#, z#, 0, -OMEGA#, 0)<>0) Then
- o\IValues[0] = CreateQuad(3, 1.1, 1.5, 0.5)
- EntityTexture(o\IValues[0], Textures_Shadow)
- PositionEntity(o\IValues[0], PickedX#(), PickedY#(), PickedZ#(), True)
- o\FValues[0] = PickedNX#()
- o\FValues[1] = PickedNY#()
- o\FValues[2] = PickedNZ#()
- MoveEntity(o\IValues[0], 0, 0.2, 0)
- ScaleEntity(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1))
- EntityAlpha(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1))
- End If
- ScaleEntity o\Entity,1.2, 1, 1.2
- TranslateEntity o\Entity, x#, y#, z#
- TurnEntity o\Entity, rx#, ry#, rz#
- Pivot = CreateCube()
- PositionEntity(Pivot, x#, y#, z#)
- ScaleEntity pivot,sx#,sy#,sz#
- EntityAlpha pivot, 0.5
- ;TurnEntity pivot,0,ry#+90,rz#
- EntityColor Pivot, 255,0,0
- Return o
- End Function
- ; =========================================================================================================
- ; Object_Goalinvis_Update
- ; =========================================================================================================
- ; Updates the goalinvis object
- Function Object_GoalInvis_Update(o.tObject, p.tPlayer, d.tDeltaTime)
- ;New code To check the state of the ring
- If (o\State=0) Then
- ; Player collided with ring
- If (Abs(EntityX(p\Objects\Entity) - o\Position\x) < o\Scale\x) And (Abs(EntityY(p\Objects\Entity) - o\Position\y) < o\Scale\y) And (Abs(EntityZ(p\Objects\Entity) - o\Position\z) < o\Scale\z) Then
- ; Bling!
- StopChannel (Channel_Music)
- StopChannel (Channel_BoostMusic)
- testdest$ = o\Dest$
- switchstage=True
- StageRestart()
- Return
- EndIf
- EndIf
- End Function
- ; /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
- ; Checkpoint
- ; /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
- ; =========================================================================================================
- ; Object_Checkpoint_Create
- ; =========================================================================================================
- ; Creates a New Ring Object
- Function Object_Checkpoint_Create.tObject(x#, y#, z#,rx#=0, ry#=0, rz#=0)
- o.tObject = New tObject
- o\ObjType = OBJTYPE_CP
- o\Position = New tVector
- o\Position\x# = x#
- o\Position\y# = y#
- o\Position\z# = z#
- o\Rotation = New tVector
- o\Rotation\x# = rx#
- o\Rotation\y# = ry#
- o\Rotation\z# = rz#
- o\Entity = CopyEntity(Check1_Model)
- o\EntityAnimation = CopyEntity(Check2_Model)
- EntityAutoFade(o\Entity, OBJECT_VIEWDISTANCE_MIN#, OBJECT_VIEWDISTANCE_MAX#)
- ScaleEntity o\Entity, 0.6, 0.6, 0.6
- TranslateEntity o\Entity, x#, y#, z#
- EntityAutoFade(o\EntityAnimation , OBJECT_VIEWDISTANCE_MIN#, OBJECT_VIEWDISTANCE_MAX#)
- ScaleEntity o\EntityAnimation , 0.6, 0.6, 0.6
- TranslateEntity o\EntityAnimation , x#, y#, z#
- TurnEntity o\Entity, rx#, ry#, rz#
- TurnEntity o\EntityAnimation, rx#, ry#, rz#
- Return o
- End Function
- Global Checkpoint_Activate = False
- Global CheckpointIdle =0
- Global Spawn_X
- Global Spawn_Y
- Global Spawn_Z
- Global Spawn_rot_X
- Global Spawn_rot_Y
- Global Spawn_rot_Z
- Global CheckTime
- ; =========================================================================================================
- ; Object_Checkpoint_Update
- ; =========================================================================================================
- ; Updates the ring object
- Function Object_Checkpoint_Update(o.tObject, p.tPlayer, d.tDeltaTime)
- ; Aaron's optimization -- get the distance only once
- dist# = EntityDistance(p\Objects\Entity, o\Entity)
- ; Check to see if the entity is within a good range for activation
- If dist > 0 And dist < 5
- ; Check to see if the entity has already been activated
- If o\State > 0 And o\State < 2
- ; NOTE: You could play a "this checkpoint is not active" sound here
- ; Return because the entity has already been activated
- Return
- EndIf
- ; NOTE: This area will NOT be reached if the entity was activated
- ; Record that this entity has been activated
- o\State = 1
- ; Begin the activation effect
- Checked = True
- PlaySound Sound_Checkpoint
- Animate o\EntityAnimation, 3, 0.75
- Spawn_X = EntityX(p\Objects\Entity)
- Spawn_Y = EntityY(p\Objects\Entity) +1
- Spawn_Z = EntityZ(p\Objects\Entity)
- Spawn_rot_X =-o\Rotation\x#
- Spawn_rot_Y =-o\Rotation\y#
- Spawn_rot_Z =-o\Rotation\z#
- CheckTime = Game\Gameplay\Time
- Return
- EndIf
- End Function
- Global NextStageDest$
- Function Object_Goal_Create.tObject(x#, y#, z#,rx#=0, ry#=0, rz#=0,Dest$,sx#,sy#,sz#)
- o.tObject = New tObject
- o\ObjType = OBJTYPE_GOAL
- o\Position = New tVector
- o\Position\x# = x#
- o\Position\y# = y#
- o\Position\z# = z#
- o\Rotation = New tVector
- o\Rotation\x# = rx#
- o\Rotation\y# = ry#
- o\Rotation\z# = rz#
- o\Dest$ = Dest$
- o\ObjectCanHoming=False
- o\Scale=New tVector
- o\Scale\x# = sx#
- o\Scale\y# = sy#
- o\Scale\z# = sz#
- o\Entity = LoadMesh("Objects\no.b3d")
- If (LinePick(x#, y#, z#, 0, -OMEGA#, 0)<>0) Then
- o\IValues[0] = CreateQuad(3, 1.1, 1.5, 0.5)
- EntityTexture(o\IValues[0], Textures_Shadow)
- PositionEntity(o\IValues[0], PickedX#(), PickedY#(), PickedZ#(), True)
- o\FValues[0] = PickedNX#()
- o\FValues[1] = PickedNY#()
- o\FValues[2] = PickedNZ#()
- MoveEntity(o\IValues[0], 0, 0.2, 0)
- ScaleEntity(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1))
- EntityAlpha(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1))
- End If
- ScaleEntity o\Entity,1.2, 1, 1.2
- TranslateEntity o\Entity, x#, y#, z#
- TurnEntity o\Entity, rx#, ry#, rz#
- Pivot = CreateCube()
- PositionEntity(Pivot, x#, y#, z#)
- ScaleEntity pivot,sx#,sy#,sz#
- EntityAlpha pivot, 0.5
- ;TurnEntity pivot,0,ry#+90,rz#
- EntityColor Pivot, 255,0,0
- Return o
- End Function
- ; =========================================================================================================
- ; Object_Goal_Update
- ; =========================================================================================================
- ; Updates the goal object
- Function Object_Goal_Update(o.tObject, p.tPlayer, d.tDeltaTime)
- ;New code To check the state of the ring
- If (o\State=0) Then
- ; Player collided with ring
- If (Abs(EntityX(p\Objects\Entity) - o\Position\x) < o\Scale\x) And (Abs(EntityY(p\Objects\Entity) - o\Position\y) < o\Scale\y) And (Abs(EntityZ(p\Objects\Entity) - o\Position\z) < o\Scale\z) Then
- ; Bling!
- StopChannel (Channel_Music)
- StopChannel (Channel_BoostMusic)
- StageRestart()
- normaldest$ = o\Dest$
- switchstage=True
- Return
- EndIf
- EndIf
- End Function
- ; =========================================================================================================
- ; Object_Invis_Create
- ; =========================================================================================================
- ; Creates a New Goalinvis Object
- Global testdest$
- Global Switchstage=False
- Global Normaldest$
- Function Object_GoalInvis_Create.tObject(x#, y#, z#,rx#=0, ry#=0, rz#=0,Dest$,sx#,sy#,sz#)
- o.tObject = New tObject
- o\ObjType = OBJTYPE_GOALINVIS
- o\Position = New tVector
- o\Position\x# = x#
- o\Position\y# = y#
- o\Position\z# = z#
- o\Rotation = New tVector
- o\Rotation\x# = rx#
- o\Rotation\y# = ry#
- o\Rotation\z# = rz#
- o\Dest$ = Dest$
- o\ObjectCanHoming=False
- o\Scale=New tVector
- o\Scale\x# = sx#
- o\Scale\y# = sy#
- o\Scale\z# = sz#
- o\Entity = LoadMesh("Objects\no.b3d")
- If (LinePick(x#, y#, z#, 0, -OMEGA#, 0)<>0) Then
- o\IValues[0] = CreateQuad(3, 1.1, 1.5, 0.5)
- EntityTexture(o\IValues[0], Textures_Shadow)
- PositionEntity(o\IValues[0], PickedX#(), PickedY#(), PickedZ#(), True)
- o\FValues[0] = PickedNX#()
- o\FValues[1] = PickedNY#()
- o\FValues[2] = PickedNZ#()
- MoveEntity(o\IValues[0], 0, 0.2, 0)
- ScaleEntity(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1))
- EntityAlpha(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1))
- End If
- ScaleEntity o\Entity,1.2, 1, 1.2
- TranslateEntity o\Entity, x#, y#, z#
- TurnEntity o\Entity, rx#, ry#, rz#
- Pivot = CreateCube()
- PositionEntity(Pivot, x#, y#, z#)
- ScaleEntity pivot,sx#,sy#,sz#
- EntityAlpha pivot, 0.5
- ;TurnEntity pivot,0,ry#+90,rz#
- EntityColor Pivot, 255,0,0
- Return o
- End Function
- ; =========================================================================================================
- ; Object_Goalinvis_Update
- ; =========================================================================================================
- ; Updates the goalinvis object
- Function Object_GoalInvis_Update(o.tObject, p.tPlayer, d.tDeltaTime)
- ;New code To check the state of the ring
- If (o\State=0) Then
- ; Player collided with ring
- If (Abs(EntityX(p\Objects\Entity) - o\Position\x) < o\Scale\x) And (Abs(EntityY(p\Objects\Entity) - o\Position\y) < o\Scale\y) And (Abs(EntityZ(p\Objects\Entity) - o\Position\z) < o\Scale\z) Then
- ; Bling!
- StopChannel (Channel_Music)
- StopChannel (Channel_BoostMusic)
- testdest$ = o\Dest$
- switchstage=True
- StageRestart()
- Return
- EndIf
- EndIf
- End Function
- ; /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
- ; Checkpoint
- ; /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
- ; =========================================================================================================
- ; Object_Checkpoint_Create
- ; =========================================================================================================
- ; Creates a New Ring Object
- Function Object_Checkpoint_Create.tObject(x#, y#, z#,rx#=0, ry#=0, rz#=0)
- o.tObject = New tObject
- o\ObjType = OBJTYPE_CP
- o\Position = New tVector
- o\Position\x# = x#
- o\Position\y# = y#
- o\Position\z# = z#
- o\Rotation = New tVector
- o\Rotation\x# = rx#
- o\Rotation\y# = ry#
- o\Rotation\z# = rz#
- o\Entity = CopyEntity(Check1_Model)
- o\EntityAnimation = CopyEntity(Check2_Model)
- EntityAutoFade(o\Entity, OBJECT_VIEWDISTANCE_MIN#, OBJECT_VIEWDISTANCE_MAX#)
- ScaleEntity o\Entity, 0.6, 0.6, 0.6
- TranslateEntity o\Entity, x#, y#, z#
- EntityAutoFade(o\EntityAnimation , OBJECT_VIEWDISTANCE_MIN#, OBJECT_VIEWDISTANCE_MAX#)
- ScaleEntity o\EntityAnimation , 0.6, 0.6, 0.6
- TranslateEntity o\EntityAnimation , x#, y#, z#
- TurnEntity o\Entity, rx#, ry#, rz#
- TurnEntity o\EntityAnimation, rx#, ry#, rz#
- Return o
- End Function
- Global Checkpoint_Activate = False
- Global CheckpointIdle =0
- Global Spawn_X
- Global Spawn_Y
- Global Spawn_Z
- Global Spawn_rot_X
- Global Spawn_rot_Y
- Global Spawn_rot_Z
- Global CheckTime
- ; =========================================================================================================
- ; Object_Checkpoint_Update
- ; =========================================================================================================
- ; Updates the ring object
- Function Object_Checkpoint_Update(o.tObject, p.tPlayer, d.tDeltaTime)
- ; Aaron's optimization -- get the distance only once
- dist# = EntityDistance(p\Objects\Entity, o\Entity)
- ; Check to see if the entity is within a good range for activation
- If dist > 0 And dist < 5
- ; Check to see if the entity has already been activated
- If o\State > 0 And o\State < 2
- ; NOTE: You could play a "this checkpoint is not active" sound here
- ; Return because the entity has already been activated
- Return
- EndIf
- ; NOTE: This area will NOT be reached if the entity was activated
- ; Record that this entity has been activated
- o\State = 1
- ; Begin the activation effect
- Checked = True
- PlaySound Sound_Checkpoint
- Animate o\EntityAnimation, 3, 0.75
- Spawn_X = EntityX(p\Objects\Entity)
- Spawn_Y = EntityY(p\Objects\Entity) +1
- Spawn_Z = EntityZ(p\Objects\Entity)
- Spawn_rot_X =-o\Rotation\x#
- Spawn_rot_Y =-o\Rotation\y#
- Spawn_rot_Z =-o\Rotation\z#
- CheckTime = Game\Gameplay\Time
- Return
- EndIf
- End Function
- Case "goal"
- ; Update progress bar
- Game_Stage_UpdateProgressBar("Loading object n."+j+": Goal Ring", Float#(j)/Float#(xmlNodeChildCount(RootChildNode)))
- positionX# = 0
- positionY# = 0
- positionZ# = 0
- rotationX# = 0
- rotationY# = 0
- rotationZ# = 0
- normalDest$ = xmlNodeAttributeValueGet(SceneChildNode, "dest")
- ; Setup position, rotation and scale.
- ScenePosition = xmlNodeFind("position", SceneChildNode)
- If (ScenePosition<>0) Then
- positionX# = Float(xmlNodeAttributeValueGet(ScenePosition, "x"))
- positionY# = Float(xmlNodeAttributeValueGet(ScenePosition, "y"))
- positionZ# = Float(xmlNodeAttributeValueGet(ScenePosition, "z"))
- End If
- SceneRotation = xmlNodeFind("rotation", SceneChildNode)
- If (SceneRotation<>0) Then
- rotationX# = Float(xmlNodeAttributeValueGet(SceneRotation, "pitch"))
- rotationY# = Float(xmlNodeAttributeValueGet(SceneRotation, "yaw"))
- rotationZ# = Float(xmlNodeAttributeValueGet(SceneRotation, "roll"))
- End If
- obj.tObject = Object_Goal_Create(positionX#, positionY#, positionZ#,rotationX#,rotationy#,rotationZ#,"")
- Case "goalinvis"
- ; Update progress bar
- Game_Stage_UpdateProgressBar("Loading object n."+j+": Stage Gate", Float#(j)/Float#(xmlNodeChildCount(RootChildNode)))
- positionX# = 0
- positionY# = 0
- positionZ# = 0
- rotationX# = 0
- rotationY# = 0
- rotationZ# = 0
- scaleX# = 5
- scaleY# = 5
- scaleZ# = 5
- Dest$ = xmlNodeAttributeValueGet(SceneChildNode, "dest")
- ; Setup position, rotation and scale.
- ScenePosition = xmlNodeFind("position", SceneChildNode)
- If (ScenePosition<>0) Then
- positionX# = Float(xmlNodeAttributeValueGet(ScenePosition, "x"))
- positionY# = Float(xmlNodeAttributeValueGet(ScenePosition, "y"))
- positionZ# = Float(xmlNodeAttributeValueGet(ScenePosition, "z"))
- End If
- SceneRotation = xmlNodeFind("rotation", SceneChildNode)
- If (SceneRotation<>0) Then
- rotationX# = Float(xmlNodeAttributeValueGet(SceneRotation, "pitch"))
- rotationY# = Float(xmlNodeAttributeValueGet(SceneRotation, "yaw"))
- rotationZ# = Float(xmlNodeAttributeValueGet(SceneRotation, "roll"))
- End If
- SceneScale = xmlNodeFind("scale", SceneChildNode)
- If (SceneScale<>0) Then
- scaleX# = Float(xmlNodeAttributeValueGet(SceneScale, "x"))
- scaleY# = Float(xmlNodeAttributeValueGet(SceneScale, "y"))
- scaleZ# = Float(xmlNodeAttributeValueGet(SceneScale, "z"))
- End If
- Object_GoalInvis_Create.tObject(x#, y#, z#,rx#=0, ry#=0, rz#=0,dest$,sx#,sy#,sz#,"")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement