-
Notifications
You must be signed in to change notification settings - Fork 0
/
HoverDroid.bb
113 lines (87 loc) · 2.82 KB
/
HoverDroid.bb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
Type HOVERDROID
Field Entity
Field G.GHOST
End Type
Const HOVERDROID_Y_OFFSET#=0.5;0.25;
Global HOVERDROID_MASTER
Function InitialiseHoverdroidFiles()
UnPackAsset(PACK_HOVERDROID_ANIM_START,PACK_HOVERDROID_ANIM_LENGTH)
UnPackAsset(PACK_HOVERDROID_MAT_START,PACK_HOVERDROID_MAT_LENGTH)
End Function
Function UnInitialiseHoverdroidFiles()
If (TEST) Then Return
DeleteFile HoverdroidAnimFile()
DeleteFile HoverdroidMatFile()
End Function
Function HoverdroidAnimFile$()
Return AnimFile(MAP_HOVERDROID_NAME)
End Function
Function HoverdroidMatFile$()
Return MatFile(MAP_HOVERDROID_NAME)
End Function
Function BuildHoverdroidMaster()
If (HOVERDROID_MASTER)
;FreeEntity HOVERDROID_MASTER
;HOVERDROID_MASTER=0
Return
End If
InitialiseHoverdroidFiles
HOVERDROID_MASTER=LoadAnimMesh(HoverdroidAnimFile())
PaintHoverdroidMaster
SetHoverdroidPhysics
UnInitialiseHoverdroidFiles
; ScaleEntity HOVERDROID_MASTER,1.0,(0.5+(0.5*SPECTRUM_MODE)),1.0,True
HideEntity HOVERDROID_MASTER
PositionEntity HOVERDROID_MASTER,0,-140,0
End Function
Function SetHoverdroidPhysics()
EntityPickMode HOVERDROID_MASTER,1;3
End Function
Function PaintHoverdroidMaster()
Local Texture=AcquireTextureMap(HoverdroidMatFile())
PaintChildren(HOVERDROID_MASTER,Texture,0,0,255)
FreeTexture Texture
EntityShininess HOVERDROID_MASTER,0.25+(SPECTRUM_MODE*0.75)
End Function
Function SpawnHoverdroid(X,Z)
Local H.HOVERDROID=New HOVERDROID
H\Entity=CopyEntity(HOVERDROID_MASTER)
NameEntity H\Entity,Str(Handle(H))
;EntityBox H\Entity,0,0.1,0,0.1,0.5,0.5
;EntityBox H\Entity,0.5,0,0.5,0.6,1.0,0.6
PositionEntity H\Entity,X-0.5,GROUND_BASELINE_Y#+(HOVERDROID_Y_OFFSET#*SPECTRUM_MODE),Z-0.5,True
RotateEntity H\Entity,0,Rand(1,4)*90,0,True
AddShadow(H\Entity)
GhostHoverdroid(H)
End Function
Function MoveHoverdroid(H.HOVERDROID)
Local Picked=EntityPick(H\Entity,0.25);0.5;0.3
If (Picked)
;Player Collision
If (Picked=PIVOT_PLAYER)
If (EntityDistance(Picked,H\Entity)<=1.2)
PlayerCollision("Hoverdroid",H\Entity)
End If
Else
Local Direction=Rand(1,3)
TurnEntity H\Entity,0,Floor(90.0*Direction),0,True
End If
End If
MoveEntity H\Entity,0,0,(GAME_MOVEMENT_SPEED*TICK)
;Wraparound
If (EntityX(H\Entity,True)<0)
PositionEntity H\Entity,EntityX(H\Entity,True)+MAPSIZEX,GROUND_BASELINE_Y#+HOVERDROID_Y_OFFSET,EntityZ(H\Entity,True),True
Else
If (EntityX(H\Entity,True)>=MAPSIZEX)
PositionEntity H\Entity,EntityX(H\Entity,True)-MAPSIZEX,GROUND_BASELINE_Y#+HOVERDROID_Y_OFFSET,EntityZ(H\Entity,True),True
End If
End If
End Function
Function RemoveHoverdroid(H.HOVERDROID)
RemoveGhost(H\G)
FreeEntity H\Entity
Delete H
End Function
;~IDEal Editor Parameters:
;~F#0#9#E#14#18#1C#33#37#3E#4D#69
;~C#Blitz3D