share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua
author mikade
Wed, 14 Sep 2011 00:06:26 +0200
changeset 5894 86c59c34cdd5
parent 5827 a416f1070fdf
child 6253 d73317579ae4
permissions -rw-r--r--
Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping. Make Racer less prone to fail. <- Please test.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
     1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
     2
loadfile(GetDataPath() .. "Scripts/Locale.lua")()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
     3
loadfile(GetDataPath() .. "Scripts/Tracker.lua")()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
     4
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
     5
---------------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
     6
---------------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
     7
---------------------------------------------------
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
     8
--- Space Invasion Code Follows (0.9)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
     9
---------------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    10
---------------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    11
-- VERSION HISTORY
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    12
----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    13
-- version 0.1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    14
----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    15
-- conversion of tumbler into space invasion
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    16
-- a million and one changes
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    17
-- bells and whistles
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    18
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    19
----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    20
-- version 0.2
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    21
----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    22
-- code slowly getting cleaner, it still looks like a spaghetti monster tho
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    23
-- lots of console tracking :/
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    24
-- all visual gears are now compulsary (will probably revert this)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    25
-- implemented fMod to try combat desyncs and bring this in line with dev
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    26
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    27
----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    28
-- version 0.3
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    29
----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    30
-- values of scoring changed to 3:10, and now based on vCircScore
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    31
-- time gained from killing a red circ increased from 3 to 4
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    32
-- circles now spawn at a distance of at least 800 or until sanity limit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    33
-- roundsLimit now based off MinesTime (kinda, its an experiment)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    34
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    35
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    36
--0.4
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    37
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    38
-- commented out a lot of WriteLnToConsoles (dont need them at this point)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    39
-- added some different WriteLnToConsoles
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    40
-- changed some of the collision detect for explosives in checkvarious()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    41
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    42
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    43
--0.5
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    44
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    45
-- added implementation for a projectile shield
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    46
-- added a "bonus" orange invader that partially recharges player shield
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    47
-- added a tough "blueboss" blue invader
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    48
-- expanded user feedback
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    49
-- circles now have health and are capable of being merely "damaged"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    50
-- redid a lot of the collision code and added CircleDamaged
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    51
-- added more sounds to events
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    52
-- added more visual gears
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    53
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    54
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    55
--0.6
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    56
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    57
-- removed a few WriteLns
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    58
-- added randomized grunts on circ damage
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    59
-- added (mostly) graceful fading out of circles :D:
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    60
-- changed odds for circles
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    61
-- changed user feedback
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    62
-- fixed the location of the explosion where player bashes into circ
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    63
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    64
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    65
--0.7
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    66
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    67
-- added PlaySound(sndSuddenDeath) when ammo gets depleted
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    68
-- added an extra "Ammo Depleted" note if user presses fire while empty
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    69
-- specified how much shield power is gained on shield powerup collection
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    70
-- changed odds for circles AGAIN, ammo is now sliiightly more common
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    71
-- switched most of the explosions/smoke effects back to non-critical vgears (with a few exceptions)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    72
-- tumbletime is now based off turntime and is variable
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    73
-- delete explosives in DeleteFarFlungBarrel rather than explode them on map boundaries to save on performance
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    74
-- utilized the improved AddCaption to tint / prevent overrides
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    75
-- temporarily disabled bugged sort that displays teams according to their score
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
    76
-- reluctantly changed the colour of the bonus circ to purple
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    77
-- standarized point notation
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    78
-- added some missing locs
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    79
-- commented out remaining WriteLnToConsoles for the meanwhile with the prefix "nw"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    80
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    81
-- ACHIEIVEMENTS added
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    82
-- (during one turn) aka repeatable
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    83
-- Ammo Manic (Destroy 3 green circles for + 5 points)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    84
-- Drone Hunter (Destroy 5 red circles for + 10 points)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    85
-- Shield Seeker (Destroy 3 purple circles for +10 points)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    86
-- Boss Slayer (Destroy 2 blue circles for +25 points)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    87
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    88
-- Shield Master (disolve 5 shells for +10 points)
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
    89
-- Shield Miser (don't use your shield at all (2.5*roundkills)+2 points)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    90
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    91
-- Depleted Kamikaze! (kamikaze into a blue/red circ when you are out of ammo) 5pts
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    92
-- Timed Kamikaze! (kamikaze into a blue/red circ when you only have 5s left) 10pts
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    93
-- Kamikaze Expert (combination of the above two) 15pts
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    94
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
    95
-- Multi-shot (destroy more than 1 invader with a single bullet) 15pts
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    96
-- X-Hit Combo (destroy another invader in less than 3 seconds) chainLength*2 points
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    97
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    98
-- Accuracy Bonus (80% accuracy at the end of your turn with more than 5 shots fired) 15pts
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    99
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   100
--(during the length of the game) aka non-repeatable
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   101
-- 10/25/50 kills (+25/+50/+100 points)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   102
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   103
-----------------
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   104
--0.8
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   105
-----------------
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   106
-- added a HUD for turntimeleft, ammo, shield
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   107
-- shieldhealth hits 0 properly
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   108
5825
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   109
------------------------
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   110
-- version 0.8.1
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   111
------------------------
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   112
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   113
-- stop hiding non-existant 4th Tag
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   114
-- redraw HUD on screen resolution change
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   115
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   116
------------------------
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   117
-- version 0.9
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   118
------------------------
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   119
-- time for more 'EXPERIMENTS' mwahahahahahaha D:
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   120
-- (hopefully) balanced Shield Miser
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   121
-- bosses are no longer a redunkulous 50 points, but toned down to 30
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   122
-- experimental radar (it's INTERACTIVE and math-heavy :D) (visual gears are safe... right? D:)
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   123
-- bugfix and balance for multishot
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   124
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   125
--------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   126
--notes for later
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   127
--------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   128
-- maybe add a check for a tie, NAH
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   129
-- more achievements? (3 kamikazes in a row, long distance shooter, supreme shield expert/miser etc?)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   130
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   131
--[[CAPTION CATEGORIES
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   132
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   133
capgrpGameState
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   134
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   135
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   136
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   137
capgrpAmmostate
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   138
-----------------
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   139
AddCaption( chainLength .. LOC_NOT("-chain! +") .. chainLength*2 .. LOC_NOT(" points!"),0xffba00ff,capgrpAmmostate)
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   140
AddCaption(LOC_NOT("Multi-shot! +15 points!"),0xffba00ff,capgrpAmmostate)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   141
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   142
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   143
capgrpAmmoinfo
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   144
-----------------
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   145
AddCaption(LOC_NOT("Shield Miser! +20 points!"),0xffba00ff,capgrpAmmoinfo)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   146
AddCaption(LOC_NOT("Shield Master! +10 points!"),0xffba00ff,capgrpAmmoinfo)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   147
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   148
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   149
capgrpVolume
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   150
-----------------
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   151
AddCaption(LOC_NOT("Boom! +25 points!"),0xffba00ff,capgrpVolume)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   152
AddCaption(LOC_NOT("BOOM! +50 points!"),0xffba00ff,capgrpVolume)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   153
AddCaption(LOC_NOT("BOOM! BOOM! BOOM! +100 points!"),0xffba00ff,capgrpVolume)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   154
AddCaption(LOC_NOT("Accuracy Bonus! +15 points!"),0xffba00ff,capgrpVolume)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   155
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   156
-----------------
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   157
capgrpMessage
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   158
-----------------
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   159
AddCaption(LOC_NOT("Ammo Depleted!"),0xff0000ff,capgrpMessage)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   160
AddCaption(LOC_NOT("Ammo: ") .. primShotsLeft)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   161
AddCaption("Shield Depleted",0xff0000ff,capgrpMessage)
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   162
AddCaption( LOC_NOT("Shield ON:") .. " " .. shieldHealth - 80 .. " " .. LOC_NOT("Power Remaining") )
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   163
AddCaption(LOC_NOT("Shield OFF:") .. " " .. shieldHealth - 80 .. " " .. LOC_NOT("Power Remaining") )
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   164
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   165
AddCaption(LOC_NOT("Time Extended!") .. "+" .. 4 .. LOC_NOT("s"), 0xff0000ff,capgrpMessage )
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   166
AddCaption("+" .. 3 .. " " .. LOC_NOT("Ammo"), 0x00ff00ff,capgrpMessage)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   167
AddCaption(LOC_NOT("Shield boosted! +30 power"), 0xff00ffff,capgrpMessage)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   168
AddCaption(LOC_NOT("Shield is fully recharged!"), 0xffae00ff,capgrpMessage)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   169
AddCaption(LOC_NOT("Boss defeated! +50 points!"), 0x0050ffff,capgrpMessage)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   170
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   171
AddCaption(LOC_NOT("GOTCHA!"))
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   172
AddCaption(LOC_NOT("Kamikaze Expert! +15 points!"),0xffba00ff,capgrpMessage)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   173
AddCaption(LOC_NOT("Depleted Kamikaze! +5 points!"),0xffba00ff,capgrpMessage)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   174
AddCaption(LOC_NOT("Timed Kamikaze! +10 points!"),0xffba00ff,capgrpMessage)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   175
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   176
-----------------
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   177
capgrpMessage2
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   178
-----------------
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   179
AddCaption(LOC_NOT("Drone Hunter! +10 points!"),0xffba00ff,capgrpMessage2)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   180
AddCaption(LOC_NOT("Ammo Maniac! +5 points!"),0xffba00ff,capgrpMessage2)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   181
AddCaption(LOC_NOT("Shield Seeker! +10 points!"),0xffba00ff,capgrpMessage2)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   182
AddCaption(LOC_NOT("Boss Slayer! +25 points!"),0xffba00ff,capgrpMessage2)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   183
]]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   184
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   185
----------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   186
-- so I herd u liek wariables
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   187
----------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   188
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   189
--local fMod = 1	-- for use in .15 single player only, otherwise desync
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   190
local fMod = 1000000 -- use this for dev and .16+ games
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   191
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   192
-- some console stuff
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   193
local shellID = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   194
local explosivesID = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   195
local luaGameTicks = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   196
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   197
-- gaudyRacer
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   198
local roundLimit = 3	-- no longer set here (see version history)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   199
local roundNumber = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   200
local firstClan = 10
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   201
local gameOver = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   202
local gameBegun = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   203
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   204
local bestClan = 10
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   205
local bestScore = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   206
local sdScore = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   207
local sdName = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   208
local sdKills = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   209
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   210
--------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   211
-- hog and team tracking variales
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   212
--------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   213
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   214
local numhhs = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   215
local hhs = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   216
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   217
local numTeams
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   218
local teamNameArr = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   219
local teamClan = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   220
local teamSize = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   221
local teamIndex = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   222
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   223
local teamComment = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   224
local teamScore = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   225
local teamCircsKilled = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   226
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   227
-- stats variables
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   228
--local teamRed = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   229
--local teamBlue = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   230
--local teamOrange = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   231
--local teamGreen = {}
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   232
local roundKills = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   233
local RK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   234
local GK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   235
local BK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   236
local OK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   237
local SK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   238
local shieldMiser = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   239
local chainCounter = 0
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   240
local chainLength = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   241
local shotsFired = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   242
local shotsHit = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   243
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   244
---------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   245
-- tumbler goods
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   246
---------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   247
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   248
local moveTimer = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   249
local leftOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   250
local rightOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   251
local upOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   252
local downOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   253
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   254
local primShotsMax = 5
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   255
local primShotsLeft = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   256
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   257
local TimeLeftCounter = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   258
local TimeLeft = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   259
local stopMovement = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   260
local tumbleStarted = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   261
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   262
local beam = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   263
local pShield
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   264
local shieldHealth
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   265
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   266
local Timer100 = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   267
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   268
local vTag = {}
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   269
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   270
-----------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   271
-- CIRCLY GOODIES
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   272
-----------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   273
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   274
local CirclesAreGo = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   275
local playerIsFine = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   276
local targetHit = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   277
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   278
local FadeAlpha = 0 -- used to fade the circles out gracefully when player dies
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   279
local pTimer = 0 -- tracking projectiles following player
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   280
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   281
local circAdjustTimer = 0		-- handle adjustment of circs direction
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   282
local m2Count = 0		-- handle speed of circs
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   283
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   284
local vCirc = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   285
local vCCount = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   286
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   287
local rCirc = {}
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   288
local rCircX = {}
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   289
local rCircY = {}
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   290
local rAlpha = 255
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   291
local rPingTimer = 0
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   292
local radShotsLeft = 0
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   293
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   294
local vCircActive = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   295
local vCircHealth = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   296
local vType = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   297
local vCounter = {}		-- how often this circ gets to "fire" etc
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   298
local vCounterLim = {} -- when vCounter == vCounterLim circle performs its special
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   299
local vCircScore = {} -- how many points killing this invader gives
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   300
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   301
local vCircRadMax = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   302
local vCircRadMin = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   303
local vCircRadDir = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   304
local vCircRadCounter = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   305
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   306
local vCircDX = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   307
local vCircDY = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   308
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   309
local vCircX = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   310
local vCircY = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   311
local vCircMinA = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   312
local vCircMaxA = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   313
local vCircType = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   314
local vCircPulse = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   315
local vCircFuckAll = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   316
local vCircRadius = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   317
local vCircWidth = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   318
local vCircCol = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   319
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   320
-------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   321
-- some lazy copypasta/modified methods
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   322
-------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   323
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   324
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   325
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   326
function HideTags()
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   327
5825
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   328
	for i = 0, 2 do
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   329
		SetVisualGearValues(vTag[i],0,0,0,0,0,1,0, 0, 240000, 0xffffff00)
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   330
	end
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   331
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   332
end
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   333
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   334
function DrawTag(i)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   335
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   336
	zoomL = 1.3
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   337
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   338
	xOffset = 40
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   339
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   340
	if i == 0 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   341
		yOffset = 40
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   342
		tCol = 0xffba00ff
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   343
		tValue = TimeLeft
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   344
	elseif i == 1 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   345
		zoomL = 1.1
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   346
		yOffset = 70
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   347
		tCol = 0x00ff00ff
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   348
		tValue = primShotsLeft
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   349
	elseif i == 2 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   350
		zoomL = 1.1
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   351
		xOffset = 40 + 35
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   352
		yOffset = 70
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   353
		tCol = 0xa800ffff
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   354
		tValue = shieldHealth - 80
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   355
	end
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   356
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   357
	DeleteVisualGear(vTag[i])
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   358
	vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   359
	g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vTag[i])
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   360
	SetVisualGearValues	(
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   361
				vTag[i], 		--id
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   362
				-(ScreenWidth/2) + xOffset,	--xoffset
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   363
				ScreenHeight - yOffset, --yoffset
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   364
				0, 			--dx
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   365
				0, 			--dy
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   366
				zoomL, 			--zoom
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   367
				1, 			--~= 0 means align to screen
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   368
				g7, 			--frameticks
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   369
				tValue, 		--value
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   370
				240000, 		--timer
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   371
				tCol		--GetClanColor( GetHogClan(CurrentHedgehog) )
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   372
				)
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   373
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   374
end
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   375
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   376
function RebuildTeamInfo()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   377
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   378
	-- make a list of individual team names
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   379
	for i = 0, (TeamsCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   380
		teamNameArr[i] = " " -- = i
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   381
		teamSize[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   382
		teamIndex[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   383
		teamScore[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   384
		teamCircsKilled[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   385
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   386
	numTeams = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   387
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   388
	for i = 0, (numhhs-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   389
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   390
		z = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   391
		unfinished = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   392
		while(unfinished == true) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   393
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   394
			newTeam = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   395
			tempHogTeamName = GetHogTeamName(hhs[i]) -- this is the new name
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   396
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   397
			if tempHogTeamName == teamNameArr[z] then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   398
				newTeam = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   399
				unfinished = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   400
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   401
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   402
			z = z + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   403
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   404
			if z == (TeamsCount-1) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   405
				unfinished = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   406
				if newTeam == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   407
					teamNameArr[numTeams] = tempHogTeamName
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   408
					numTeams = numTeams + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   409
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   410
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   411
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   412
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   413
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   414
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   415
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   416
	-- find out how many hogs per team, and the index of the first hog in hhs
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   417
	for i = 0, (TeamsCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   418
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   419
		for z = 0, (numhhs-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   420
			if GetHogTeamName(hhs[z]) == teamNameArr[i] then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   421
				teamClan[i] = GetHogClan(hhs[z])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   422
				if teamSize[i] == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   423
					teamIndex[i] = z -- should give starting index
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   424
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   425
				teamSize[i] = teamSize[i] + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   426
				--add a pointer so this hog appears at i in hhs
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   427
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   428
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   429
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   430
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   431
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   432
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   433
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   434
-- control
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   435
function AwardPoints(p)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   436
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   437
	for i = 0,(TeamsCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   438
		if teamClan[i] == GetHogClan(CurrentHedgehog) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   439
			teamScore[i] = teamScore[i] + p
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   440
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   441
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   442
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   443
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   444
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   445
function AwardKills(t)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   446
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   447
	roundKills = roundKills + 1
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   448
	
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   449
	for i = 0,(TeamsCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   450
		if teamClan[i] == GetHogClan(CurrentHedgehog) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   451
			teamCircsKilled[i] = teamCircsKilled[i] + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   452
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   453
			if teamCircsKilled[i] == 10 then
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   454
				AddCaption(loc("Boom!") .. " +25 " .. loc("points").."!",0xffba00ff,capgrpVolume)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   455
				AwardPoints(25)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   456
			elseif teamCircsKilled[i] == 25 then
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   457
				AddCaption(loc("BOOM!") .. " +50 " .. loc("points") .. "!",0xffba00ff,capgrpVolume)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   458
				AwardPoints(50)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   459
			elseif teamCircsKilled[i] == 50 then
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   460
				AddCaption(loc("BOOM!") .. loc("BOOM!") .. loc("BOOM!") .. " +100 " .. loc("points") .. "!",0xffba00ff,capgrpVolume)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   461
				AwardPoints(100)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   462
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   463
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   464
			--[[
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   465
			if t == "R" then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   466
				redCircsKilled[i] = redCircsKilled[i] + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   467
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   468
			--etc
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   469
			--etc
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   470
			]]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   471
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   472
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   473
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   474
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   475
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   476
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   477
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   478
function bubbleSort(table)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   479
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   480
	for i = 1, #table do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   481
        for j = 2, #table do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   482
            if table[j] < table[j-1] then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   483
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   484
				temp = table[j-1]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   485
				t2 = sdName[j-1]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   486
				t3 = sdKills[j-1]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   487
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   488
				table[j-1] = table[j]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   489
                sdName[j-1] = sdName[j]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   490
				sdKills[j-1] = sdKills[j]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   491
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   492
				table[j] = temp
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   493
				sdName[j] = t2
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   494
				sdKills[j] = t3
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   495
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   496
            end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   497
        end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   498
    end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   499
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   500
    return
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   501
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   502
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   503
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   504
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   505
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   506
function CommentOnScore()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   507
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   508
	for i = 0,(TeamsCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   509
		sdScore[i] = teamScore[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   510
		sdKills[i] = teamCircsKilled[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   511
		sdName[i] = teamNameArr[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   512
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   513
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   514
	--bubbleSort(sdScore)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   515
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   516
	for i = 0,(TeamsCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   517
		if sdName[i] ~= " " then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   518
			teamComment[i] = sdName[i] .. " |" ..
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   519
			loc("SCORE") .. ": " .. sdScore[i] .. " " .. loc("points") .. "|" ..
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   520
			loc("KILLS") .. ": " .. sdKills[i] .. " " .. loc("invaders destroyed") .. "|" ..
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   521
			" " .. "|"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   522
		elseif sdName[i] == " " then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   523
			teamComment[i] = "|"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   524
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   525
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   526
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   527
	entireC = ""
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   528
	for i = (TeamsCount-1),0,-1 do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   529
		entireC = entireC .. teamComment[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   530
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   531
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   532
	ShowMission("SPACE INVASION", loc("STATUS UPDATE"), loc("Rounds Complete") .. ": " .. roundNumber .. "/" .. roundLimit .. "| " .. "|" .. loc("Team Scores") .. ": |" ..entireC, 4, 1)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   533
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   534
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   535
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   536
-- gaudy racer
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   537
function CheckForNewRound()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   538
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   539
	if GetHogClan(CurrentHedgehog) == firstClan then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   540
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   541
		roundNumber = roundNumber + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   542
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   543
		CommentOnScore()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   544
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   545
		-- end game if its at round limit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   546
		if roundNumber == roundLimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   547
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   548
			for i = 0, (TeamsCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   549
				if teamScore[i] > bestScore then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   550
					bestScore = teamScore[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   551
					bestClan = teamClan[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   552
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   553
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   554
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   555
			for i = 0, (numhhs-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   556
				if GetHogClan(hhs[i]) ~= bestClan then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   557
					SetEffect(hhs[i], heResurrectable, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   558
					SetHealth(hhs[i],0)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   559
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   560
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   561
			gameOver = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   562
			TurnTimeLeft = 0	--1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   563
			TimeLeft = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   564
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   565
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   566
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   567
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   568
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   569
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   570
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   571
----------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   572
-- some tumbler/space invaders methods
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   573
----------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   574
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   575
function isATrackedGear(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   576
	if 	(GetGearType(gear) == gtExplosives) or
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   577
		(GetGearType(gear) == gtShell) or
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   578
		(GetGearType(gear) == gtFlame) or-- new -- gtBall
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   579
		(GetGearType(gear) == gtBall)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   580
	then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   581
		return(true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   582
	else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   583
		return(false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   584
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   585
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   586
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   587
function setNewGearValues(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   588
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   589
	if GetGearType(gear) == gtShell then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   590
		lfs = 50	-- roughly 5 seconds
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   591
		shellID = shellID + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   592
		setGearValue(gear,"ID",shellID)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   593
		--nw WriteLnToConsole("Just assigned ID " .. getGearValue(gear,"ID") .. " to this shell")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   594
	elseif GetGearType(gear) == gtBall then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   595
		lfs = 70	-- 7s
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   596
	elseif GetGearType(gear) == gtExplosives then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   597
		lfs = 15	-- 1.5s
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   598
		explosivesID = explosivesID + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   599
		setGearValue(gear,"ID",explosivesID)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   600
		--nw WriteLnToConsole("Just assigned ID " .. getGearValue(gear,"ID") .. " to this explosives")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   601
	elseif GetGearType(gear) == gtFlame then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   602
		lfs = 5	-- 0.5s
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   603
	else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   604
		lfs = 100
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   605
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   606
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   607
	setGearValue(gear,"lifespan",lfs)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   608
	--WriteLnToConsole("I also set its lifespan to " .. lfs)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   609
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   610
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   611
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   612
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   613
function HandleLifeSpan(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   614
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   615
	decreaseGearValue(gear,"lifespan")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   616
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   617
	--WriteLnToConsole("Just decreased the lifespan of a gear to " .. getGearValue(gear,"lifespan"))
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   618
	--WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   619
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   620
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   621
	if getGearValue(gear,"lifespan") == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   622
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   623
		if GetGearType(gear) == gtShell then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   624
			AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   625
			WriteLnToConsole("about to delete a shell due to lifespan == 0")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   626
		--elseif GetGearType(gear) == gtBall then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   627
		--	AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   628
		elseif GetGearType(gear) == gtExplosives then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   629
			AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   630
			--nw WriteLnToConsole("about to delete a explosive due to lifespan == 0")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   631
		elseif GetGearType(gear) == gtFlame then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   632
			AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   633
			--WriteLnToConsole("about to delete flame due to lifespan == 0")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   634
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   635
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   636
		DeleteGear(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   637
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   638
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   639
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   640
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   641
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   642
-- this prevents ugly barrel clipping sounds when a barrel flies off map limits
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   643
function DeleteFarFlungBarrel(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   644
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   645
	if GetGearType(gear) == gtExplosives then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   646
		if 	(GetX(gear) < -1900) or
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   647
			(GetX(gear) > 6200) or
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   648
			(GetY(gear) < -3400)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   649
		then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   650
			AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   651
			DeleteGear(gear)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   652
			--SetHealth(gear, 0)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   653
			--WriteLnToConsole("I'm setting barrel ID " .. getGearValue(gear,"ID") .. " to 0 health because it's been flung too close to the map edges. at Game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   654
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   655
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   656
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   657
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   658
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   659
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   660
-----------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   661
--EVENT HANDLERS
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   662
-- action keys
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   663
-----------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   664
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   665
-- o rite dis wan iz liek synched n stuff hope full lee
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   666
function onPrecise()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   667
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   668
	--WriteLnToConsole("onPrecise event handler at Game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   669
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   670
	-- Fire Barrel
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   671
	if (primShotsLeft > 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   672
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   673
		shotsFired = shotsFired +1
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   674
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   675
		morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtExplosives, 0, 0, 0, 1)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   676
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   677
		primShotsLeft = primShotsLeft - 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   678
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   679
		if primShotsLeft == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   680
			PlaySound(sndSuddenDeath)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   681
			AddCaption(loc("Ammo Depleted!"),0xff0000ff,capgrpMessage)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   682
		else
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   683
			AddCaption(loc("Ammo") .. ": " .. primShotsLeft)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   684
		end
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   685
		DrawTag(1)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   686
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   687
		CopyPV(CurrentHedgehog, morte) -- new addition
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   688
		x,y = GetGearVelocity(morte)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   689
		--WriteLnToConsole("I'm going to shoot a barrel so I just got the velocity of currenthedgehog. It is dx: " .. x .. "; dy: " .. y)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   690
		--WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   691
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   692
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   693
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   694
		x = x*2
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   695
		y = y*2
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   696
		SetGearVelocity(morte, x, y)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   697
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   698
		--WriteLnToConsole("I just SET the velocity of a barrel I created. It is now dx: " .. x .. "; dy: " .. y)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   699
		--WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   700
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   701
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   702
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   703
	elseif (primShotsLeft == 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   704
		AddCaption(loc("Ammo Depleted!"),0xff0000ff,capgrpMessage)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   705
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   706
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   707
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   708
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   709
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   710
function onLJump()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   711
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   712
	if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   713
		shieldMiser = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   714
		if shieldHealth == 80 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   715
			AddCaption("Shield Depleted",0xff0000ff,capgrpMessage)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   716
			PlaySound(sndMineTick)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   717
			PlaySound(sndSwitchHog)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   718
		elseif (beam == false) and (shieldHealth > 80) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   719
			beam = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   720
			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 40, 255, 1, 10, 0, 300, 1, 0xa800ffff)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   721
			AddCaption( loc("Shield ON:") .. " " .. shieldHealth - 80 .. " " .. loc("Power Remaining") )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   722
			PlaySound(sndWarp)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   723
		else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   724
			beam = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   725
			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 0, 0, 1, 10, 0, 0, 0, 0xa800ffff)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   726
			AddCaption(loc("Shield OFF:") .. " " .. shieldHealth - 80 .. " " .. loc("Power Remaining") )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   727
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   728
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   729
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   730
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   731
function onHJump()
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   732
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   733
	if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) and 
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   734
	(rAlpha == 255) and (radShotsLeft > 0) then
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   735
		rPingTimer = 0
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   736
		rAlpha = 0
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   737
		radShotsLeft = radShotsLeft -1
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   738
		AddCaption(loc("Pings left:") .. " " .. radShotsLeft,GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage)
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   739
	end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   740
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   741
end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   742
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   743
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   744
-- movement keys
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   745
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   746
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   747
function onLeft()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   748
	leftOn = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   749
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   750
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   751
function onRight()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   752
	rightOn = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   753
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   754
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   755
function onUp()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   756
	upOn = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   757
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   758
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   759
function onDown()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   760
	downOn = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   761
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   762
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   763
function onDownUp()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   764
	downOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   765
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   766
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   767
function onUpUp()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   768
	upOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   769
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   770
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   771
function onLeftUp()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   772
	leftOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   773
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   774
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   775
function onRightUp()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   776
	rightOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   777
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   778
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   779
--------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   780
-- other event handlers
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   781
--------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   782
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   783
function onGameInit()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   784
	GameFlags = 0 + gfRandomOrder
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   785
	Theme = "EarthRise"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   786
	CaseFreq = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   787
	HealthCaseProb = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   788
	MinesNum = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   789
	Explosives = 0
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   790
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   791
	for i = 0, 3 do
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   792
		vTag[0] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   793
	end
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   794
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   795
	HideTags()
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   796
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   797
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   798
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   799
function onGameStart()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   800
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   801
	if (MinesTime == -1000) or (MinesTime == 0) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   802
		roundLimit = 3
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   803
	else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   804
		roundLimit = (MinesTime / 1000)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   805
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   806
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   807
	ShowMission	(
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   808
				"SPACE INVASION",
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   809
				loc("a Hedgewars mini-game"),
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   810
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   811
				loc("Destroy invaders to score points.") .. "|" ..
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   812
				" " .. "|" ..
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   813
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   814
				loc("Round Limit") .. ": " .. roundLimit .. "|" ..
5332
b29d60c7cac7 Use an ifdef instead, add despeckling of tunnels
nemo
parents: 5325
diff changeset
   815
				loc("Turn Time") .. ": " .. (TurnTime/1000) .. loc("sec") .. "|" ..
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   816
				" " .. "|" ..
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   817
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   818
				loc("Movement: [Up], [Down], [Left], [Right]") .. "|" ..
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   819
				loc("Fire") .. ": " .. loc("[Left Shift]") .. "|" ..
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   820
				loc("Toggle Shield") .. ": " .. loc("[Enter]") .. "|" ..
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   821
				loc("Radar Ping") .. ": " .. loc("[Backspace]") .. "|" ..
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   822
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   823
				--" " .. "|" ..
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   824
				--LOC_NOT("Invaders List: ") .. "|" ..
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   825
				--LOC_NOT("Blue Jabberwock: (50 points)") .. "|" ..
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   826
				--LOC_NOT("Red Warbler: (10 points)") .. "|" ..
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   827
				--LOC_NOT("Orange Gob: (5 points)") .. "|" ..
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   828
				--LOC_NOT("Green Wrangler: (3 points)") .. "|" ..
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   829
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   830
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   831
				"", 4, 4000
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   832
				)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   833
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   834
	CreateMeSomeCircles()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   835
	RebuildTeamInfo() -- control
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   836
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   837
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   838
5825
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   839
function onScreenResize()
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   840
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   841
	-- redraw Tags so that their screen locations are updated
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   842
	if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   843
			DrawTag(0)
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   844
			DrawTag(1)
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   845
			DrawTag(2)
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   846
	end
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   847
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   848
end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   849
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   850
function onNewTurn()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   851
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   852
	primShotsLeft = primShotsMax
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   853
	radShotsLeft = 2
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   854
	stopMovement = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   855
	tumbleStarted = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   856
	beam = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   857
	shieldHealth = 30 + 80 -- 50 = 5 secs, roughly
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   858
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   859
	RK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   860
	GK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   861
	BK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   862
	OK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   863
	SK = 0
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   864
	roundKills = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   865
	shieldMiser = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   866
	shotsFired = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   867
	shotsHit = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   868
	chainLength = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   869
	chainCounter = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   870
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   871
	-------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   872
	-- gaudy racer
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   873
	-------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   874
	CheckForNewRound()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   875
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   876
	-- Handle Starting Stage of Game
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   877
	if (gameOver == false) and (gameBegun == false) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   878
		gameBegun = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   879
		roundNumber = 0 -- 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   880
		firstClan = GetHogClan(CurrentHedgehog)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   881
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   882
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   883
	if gameOver == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   884
		gameBegun = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   885
		stopMovement = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   886
		tumbleStarted = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   887
		SetMyCircles(false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   888
	end
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   889
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   890
	HideTags()
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   891
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   892
	---------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   893
	---------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   894
	--AddCaption("num g: " .. numGears() )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   895
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   896
	--WriteLnToConsole("onNewTurn, I just set a bunch of variables to their necessary states. This was done at:")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   897
	--WriteLnToConsole("The above occured at Game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   898
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   899
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   900
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   901
function ThingsToBeRunOnGears(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   902
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   903
	HandleLifeSpan(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   904
	DeleteFarFlungBarrel(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   905
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   906
	if CirclesAreGo == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   907
		CheckVarious(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   908
		ProjectileTrack(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   909
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   910
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   911
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   912
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   913
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   914
function onGameTick()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   915
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   916
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   917
	--WriteLnToConsole("Start of GameTick")
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   918
	luaGameTicks = luaGameTicks + 1 -- GameTime
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   919
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   920
	HandleCircles()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   921
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   922
	Timer100 = Timer100 + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   923
	if Timer100 >= 100 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   924
		Timer100 = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   925
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   926
		if beam == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   927
			shieldHealth = shieldHealth - 1
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   928
			if shieldHealth < 80 then -- <= 80
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   929
				shieldHealth = 80
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   930
				beam = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   931
				AddCaption(loc("Shield Depleted"),0xff0000ff,capgrpMessage)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   932
				PlaySound(sndMineTick)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   933
				PlaySound(sndSwitchHog)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   934
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   935
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   936
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   937
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   938
		--nw WriteLnToConsole("Starting ThingsToBeRunOnGears()")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   939
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   940
		runOnGears(ThingsToBeRunOnGears)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   941
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   942
		--nw WriteLnToConsole("Finished ThingsToBeRunOnGears()")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   943
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   944
		--runOnGears(HandleLifeSpan)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   945
		--runOnGears(DeleteFarFlungBarrel)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   946
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   947
		if CirclesAreGo == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   948
			CheckDistances()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   949
			--runOnGears(CheckVarious)	-- used to be in handletracking for some bizarre reason
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   950
			--runOnGears(ProjectileTrack)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   951
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   952
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   953
		-- white smoke trail as player falls from the sky
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   954
		if (TimeLeft <= 0) and (stopMovement == true) and (CurrentHedgehog ~= nil) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   955
			j,k = GetGearVelocity(CurrentHedgehog)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   956
			if (j ~= 0) and (k ~= 0) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   957
				AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmoke, 0, true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   958
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   959
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   960
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   961
		--nw WriteLnToConsole("Finished 100Timer")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   962
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   963
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   964
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   965
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   966
	-- start the player tumbling with a boom once their turn has actually begun
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   967
	if (tumbleStarted == false) and (gameOver == false) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   968
		if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   969
			--AddCaption(LOC_NOT("Good to go!"))
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   970
			tumbleStarted = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   971
			TimeLeft = (TurnTime/1000)	--45
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   972
			FadeAlpha = 0
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   973
			rAlpha = 255
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   974
			AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   975
			DrawTag(0)
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   976
			DrawTag(1)
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   977
			DrawTag(2)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   978
			SetMyCircles(true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   979
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   980
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   981
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   982
	--WriteLnToConsole("Finished initial check")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   983
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   984
	if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   985
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   986
		--AddCaption(GetX(CurrentHedgehog) .. ";" .. GetY(CurrentHedgehog) )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   987
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   988
		-- Calculate and display turn time
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   989
		TimeLeftCounter = TimeLeftCounter + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   990
		if TimeLeftCounter == 1000 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   991
			TimeLeftCounter = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   992
			TimeLeft = TimeLeft - 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   993
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   994
			if TimeLeft >= 0 then
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   995
				--AddCaption(LOC_NOT("Time Left: ") .. TimeLeft)
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   996
				DrawTag(0)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   997
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   998
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   999
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1000
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1001
		--WriteLnToConsole("Finished timeleft calculations")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1002
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1003
		-------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1004
		-- Player has run out of luck (out of time or hit by gtShell)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1005
		-------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1006
		-- checks in FloatyThings
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1007
		if PlayerIsFine() == false then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1008
			TimeLeft = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1009
		end
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1010
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1011
		--WriteLnToConsole("successfully checked playerIsFine")
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1012
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1013
		if (TimeLeft == 0) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1014
			if (stopMovement == false) then	--time to stop the player
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1015
				stopMovement = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1016
				beam = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1017
				upOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1018
				down = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1019
				leftOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1020
				rightOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1021
				SetMyCircles(false)
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  1022
				HideTags()
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1023
				rAlpha = 255
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1024
				--nw WriteLnToConsole("Player is out of luck")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1025
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1026
				if shieldMiser == true then
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1027
					
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1028
					p = (roundKills*2.5) - ((roundKills*2.5)%1) + 2
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1029
					--p = (roundKills*2.5) + 2
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1030
					--if (p%2 ~= 0) then
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1031
					--	p = p -0.5					
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1032
					--end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1033
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1034
					AddCaption(loc("Shield Miser!") .." +" .. p .." ".. loc("points") .. "!",0xffba00ff,capgrpAmmoinfo)
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1035
					AwardPoints(p)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1036
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1037
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1038
				if ((shotsHit / shotsFired * 100) >= 80) and (shotsFired > 4) then
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
  1039
					AddCaption(loc("Accuracy Bonus!") .. " +15 " .. loc("points") .. "!",0xffba00ff,capgrpVolume)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1040
					AwardPoints(15)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1041
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1042
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1043
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1044
		else -- remove this if you want tumbler to fall slowly on death
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1045
		-------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1046
		-- Player is still in luck
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1047
		-------------------------------
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1048
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1049
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1050
			--WriteLnToConsole("about to do chainCounter checks")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1051
			if chainCounter > 0 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1052
				chainCounter = chainCounter -1
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1053
				if chainCounter == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1054
					chainLength = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1055
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1056
			end
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1057
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1058
			-- handle movement based on IO
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1059
			moveTimer = moveTimer + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1060
			if moveTimer == 100 then -- 100
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1061
				--nw WriteLnToConsole("Start of Player MoveTimer")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1062
				moveTimer = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1063
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1064
				---------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1065
				-- new trail code
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1066
				---------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1067
				-- the trail lets you know you have 5s left to pilot, akin to birdy feathers
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1068
				if (TimeLeft <= 5) and (TimeLeft > 0) then							--vgtSmoke
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1069
					tempE = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmoke, 0, true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1070
					g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1071
					SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, GetClanColor(GetHogClan(CurrentHedgehog)) )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1072
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1073
				--------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1074
				--------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1075
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1076
				dx, dy = GetGearVelocity(CurrentHedgehog)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1077
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1078
				--WriteLnToConsole("I just got the velocity of currenthedgehog. It is dx: " .. dx .. "; dy: " .. dy)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1079
				--WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1080
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1081
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1082
				dxlimit = 0.4*fMod
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1083
				dylimit = 0.4*fMod
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1084
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1085
				if dx > dxlimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1086
					dx = dxlimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1087
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1088
				if dy > dylimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1089
					dy = dylimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1090
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1091
				if dx < -dxlimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1092
					dx = -dxlimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1093
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1094
				if dy < -dylimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1095
					dy = -dylimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1096
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1097
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1098
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1099
				if leftOn == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1100
					dx = dx - 0.1*fMod
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1101
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1102
				if rightOn == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1103
					dx = dx + 0.1*fMod
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1104
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1105
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1106
				if upOn == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1107
					dy = dy - 0.1*fMod
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1108
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1109
				if downOn == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1110
					dy = dy + 0.1*fMod
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1111
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1112
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1113
				SetGearVelocity(CurrentHedgehog, dx, dy)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1114
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1115
				--WriteLnToConsole("I just SET the velocity of currenthedgehog. It is now dx: " .. dx .. "; dy: " .. dy)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1116
				--WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1117
				--nw WriteLnToConsole("End of Player MoveTimer")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1118
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1119
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1120
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1121
		end -- new end I put here to check if he's still alive or not
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1122
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1123
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1124
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1125
	--WriteLnToConsole("End of GameTick")
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1126
	
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1127
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1128
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1129
function onGearResurrect(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1130
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1131
	-- did I fall into the water? well, that was a stupid thing to do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1132
	if gear == CurrentHedgehog then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1133
		TimeLeft = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1134
		--WriteLnToConsole("Current hedgehog just drowned himself")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1135
		--WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1136
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1137
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1138
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1139
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1140
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1141
function onGearAdd(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1142
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1143
	if isATrackedGear(gear) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1144
		trackGear(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1145
		setNewGearValues(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1146
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1147
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1148
	--if GetGearType(gear) == gtBall then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1149
	--	SetTimer(gear, 5000)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1150
	--end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1151
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1152
	if GetGearType(gear) == gtHedgehog then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1153
		SetEffect(gear, heResurrectable, true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1154
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1155
		-----------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1156
		-- control
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1157
		hhs[numhhs] = gear
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1158
		numhhs = numhhs + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1159
		-----------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1160
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1161
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1162
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1163
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1164
function onGearDelete(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1165
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1166
	if GetGearType(gear) == gtShell then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1167
		--nw WriteLnToConsole("on GearDelete call. Shell ID: " .. getGearValue(gear,"ID"))
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1168
		--WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1169
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1170
		--if CurrentHedgehog ~= nil then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1171
		--	WriteLnToConsole("As it happens, player is at: " .. GetX(CurrentHedgehog) .. "; " .. GetY(CurrentHedgehog))
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1172
		--end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1173
	elseif GetGearType(gear) == gtExplosives then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1174
		--nw WriteLnToConsole("on GearDelete call. Explosives ID: " .. getGearValue(gear,"ID"))
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1175
		--WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1176
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1177
		--if CurrentHedgehog ~= nil then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1178
		--	WriteLnToConsole("As it happens, player is at: " .. GetX(CurrentHedgehog) .. "; " .. GetY(CurrentHedgehog))
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1179
		--end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1180
	elseif GetGearType(gear) == gtFlame then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1181
		--WriteLnToConsole("on GearDelete flame")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1182
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1183
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1184
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1185
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1186
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1187
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1188
	if isATrackedGear(gear) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1189
		trackDeletion(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1190
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1191
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1192
	if CurrentHedgehog ~= nil then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1193
		FollowGear(CurrentHedgehog)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1194
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1195
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1196
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1197
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1198
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1199
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1200
------------------------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1201
------------------------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1202
------------------------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1203
------------------------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1204
-- FLOATY THINGS
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1205
-- "I'll make this into a generic library and code properly
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1206
-- when I have more time and feel less lazy"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1207
------------------------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1208
------------------------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1209
------------------------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1210
------------------------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1211
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1212
function DoHorribleThings(cUID)
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1213
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1214
	-- maybe	
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1215
	-- add a check to draw it inside the circ and not past it if
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1216
	-- it is closer than 150 or w/e
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1217
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1218
	-- work out the distance to the target	
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1219
	g1X, g1Y = GetGearPosition(CurrentHedgehog)
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1220
	g2X, g2Y = vCircX[cUID], vCircY[cUID]
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1221
	q = g1X - g2X				
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1222
	w = g1Y - g2Y				
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1223
	r = math.sqrt( (q*q) + (w*w) )	--alternate
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1224
	
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1225
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1226
	opp = w	
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1227
	if opp < 0 then
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1228
		opp = opp*-1
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1229
	end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1230
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1231
	-- work out the angle (theta) to the target
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1232
	t = math.deg ( math.asin(opp / r) )
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1233
		
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1234
	-- based on the radius of the radar, calculate what x/y displacement should be	
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1235
	NR = 150 -- radius at which to draw circs
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1236
	NX = math.cos( math.rad(t) ) * NR
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1237
	NY = math.sin( math.rad(t) ) * NR	
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1238
		
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1239
	-- displace xy based on where this thing actually is
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1240
	if q > 0 then
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1241
		rCircX[cUID] = g1X - NX
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1242
	else
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1243
		rCircX[cUID] = g1X + NX
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1244
	end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1245
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1246
	if w > 0 then
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1247
		rCircY[cUID] = g1Y - NY
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1248
	else
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1249
		rCircY[cUID] = g1Y + NY
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1250
	end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1251
	
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1252
end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1253
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1254
function PlayerIsFine()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1255
	return (playerIsFine)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1256
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1257
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1258
function GetDistFromGearToGear(gear, gear2)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1259
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1260
	g1X, g1Y = GetGearPosition(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1261
	g2X, g2Y = GetGearPosition(gear2)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1262
	q = g1X - g2X
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1263
	w = g1Y - g2Y
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1264
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1265
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1266
	--[[
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1267
	WriteLnToConsole("I just got the position of two gears and calculated the distance betwen them")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1268
	if gear == CurrentHedgehog then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1269
		WriteLnToConsole("Gear 1 is CurrentHedgehog.")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1270
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1271
	if gear2 == CurrentHedgehog then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1272
		WriteLnToConsole("Gear 2 is CurrentHedgehog.")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1273
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1274
	WriteLnToConsole("G1X: " .. g1X .. "; G1Y: " .. g1Y)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1275
	WriteLnToConsole("G2X: " .. g2X .. "; G2Y: " .. g2Y)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1276
	WriteLnToConsole("Their distance is " .. (q*q) + (w*w) )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1277
	WriteLnToConsole("The above events occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1278
]]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1279
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1280
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1281
	return ( (q*q) + (w*w) )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1282
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1283
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1284
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1285
function GetDistFromGearToXY(gear, g2X, g2Y)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1286
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1287
	g1X, g1Y = GetGearPosition(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1288
	q = g1X - g2X
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1289
	w = g1Y - g2Y
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1290
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1291
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1292
	--[[WriteLnToConsole("I just got the position of a gear and calculated the distance betwen it and another xy")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1293
	if gear == CurrentHedgehog then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1294
		WriteLnToConsole("Gear 1 is CurrentHedgehog.")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1295
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1296
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1297
	WriteLnToConsole("G1X: " .. g1X .. "; G1Y: " .. g1Y)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1298
	WriteLnToConsole("Other X: " .. g2X .. "; Other Y: " .. g2Y)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1299
	WriteLnToConsole("Their distance is " .. (q*q) + (w*w) )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1300
	WriteLnToConsole("The above events occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1301
]]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1302
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1303
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1304
	return ( (q*q) + (w*w) )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1305
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1306
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1307
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1308
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1309
function CreateMeSomeCircles()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1310
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1311
	for i = 0, 7 do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1312
		vCCount = vCCount +1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1313
		vCirc[i] = AddVisualGear(0,0,vgtCircle,0,true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1314
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1315
		rCirc[i] = AddVisualGear(0,0,vgtCircle,0,true)
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1316
		rCircX[i] = 0
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1317
		rCircY[i] = 0
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1318
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1319
		vCircDX[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1320
		vCircDY[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1321
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1322
		vType[i] = "generic"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1323
		vCounter[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1324
		vCounterLim[i] = 3000
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1325
		vCircScore[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1326
		vCircHealth[i] = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1327
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1328
		vCircMinA[i] = 80	--80 --20
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1329
		vCircMaxA[i] = 255
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1330
		vCircType[i] = 1	--1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1331
		vCircPulse[i] = 10
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1332
		vCircFuckAll[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1333
		vCircRadius[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1334
		vCircWidth[i] = 3 --5
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1335
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1336
		vCircRadMax[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1337
		vCircRadMin[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1338
		vCircRadDir[i] = -1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1339
		vCircRadCounter[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1340
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1341
		vCircX[i], vCircY[i] = 0,0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1342
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1343
		vCircCol[i] = 0xff00ffff
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1344
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1345
		SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i])
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1346
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1347
		SetVisualGearValues(rCirc[i], 0, 0, 100, 255, 1, 10, 0, 40, 3, vCircCol[i])
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1348
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1349
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1350
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1351
	pShield = AddVisualGear(0,0,vgtCircle,0,true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1352
	--SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 80, 200, 1, 10, 0, 200, 5, 0xff00ffff)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1353
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1354
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1355
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1356
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1357
function IGotMeASafeXYValue(i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1358
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1359
	acceptibleDistance = 800
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1360
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1361
	-- put this in here to thwart attempts at repositioning and test sanity limit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1362
	--vCircX[i] = GetX(CurrentHedgehog)+250
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1363
	--vCircY[i] = GetY(CurrentHedgehog)+250
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1364
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1365
	vCircX[i] = GetRandom(5000)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1366
	vCircY[i] = GetRandom(2000)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1367
	dist = GetDistFromGearToXY(CurrentHedgehog, vCircX[i], vCircY[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1368
	if dist > acceptibleDistance*acceptibleDistance then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1369
		return(true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1370
	else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1371
		return(false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1372
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1373
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1374
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1375
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1376
function CircleDamaged(i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1377
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1378
	res = ""
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1379
	vCircHealth[i] = vCircHealth[i] -1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1380
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1381
	if vCircHealth[i] <= 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1382
	-- circle is dead, do death effects/consequences
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1383
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1384
		vCircActive[i] = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1385
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1386
		if (vType[i] == "drone") then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1387
			PlaySound(sndHellishImpact4)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1388
			TimeLeft = TimeLeft + 4
5332
b29d60c7cac7 Use an ifdef instead, add despeckling of tunnels
nemo
parents: 5325
diff changeset
  1389
			AddCaption(loc("Time Extended!") .. "+" .. 4 .. loc("sec"), 0xff0000ff,capgrpMessage )
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  1390
			DrawTag(0)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1391
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1392
			morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1393
			SetHealth(morte, 0)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1394
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1395
			RK = RK + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1396
			if RK == 5 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1397
				RK = 0
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
  1398
				AddCaption(loc("Drone Hunter!") .. " +10 " .. loc("points") .. "!",0xffba00ff,capgrpMessage2)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1399
				AwardPoints(10)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1400
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1401
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1402
		elseif (vType[i] == "ammo") then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1403
			AddVisualGear(vCircX[i], vCircY[i], vgtExplosion, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1404
			PlaySound(sndExplosion)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1405
			PlaySound(sndShotgunReload)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1406
			primShotsLeft = primShotsLeft + 3
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1407
			AddCaption("+" .. 3 .. " " .. loc("Ammo"), 0x00ff00ff,capgrpMessage)
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  1408
			DrawTag(1)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1409
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1410
			GK = GK + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1411
			if GK == 3 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1412
				GK = 0
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
  1413
				AddCaption(loc("Ammo Maniac!") .. " +5 " .. loc("points") .. "!",0xffba00ff,capgrpMessage2)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1414
				AwardPoints(5)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1415
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1416
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1417
		elseif (vType[i] == "bonus") then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1418
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1419
			AddVisualGear(vCircX[i], vCircY[i], vgtExplosion, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1420
			PlaySound(sndExplosion)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1421
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1422
			AddVisualGear(vCircX[i], vCircY[i], vgtFire, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1423
			AddVisualGear(vCircX[i], vCircY[i], vgtFire, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1424
			AddVisualGear(vCircX[i], vCircY[i], vgtFire, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1425
			AddVisualGear(vCircX[i], vCircY[i], vgtFire, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1426
			AddVisualGear(vCircX[i], vCircY[i], vgtFire, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1427
			AddVisualGear(vCircX[i], vCircY[i], vgtSmoke, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1428
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1429
			PlaySound(sndVaporize)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1430
			--sndWarp sndMineTick --sndSwitchHog --sndSuddenDeath
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1431
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1432
			shieldHealth = shieldHealth + 30
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1433
			AddCaption(loc("Shield boosted! +30 power"), 0xa800ffff,capgrpMessage)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1434
			if shieldHealth >= 250 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1435
				shieldHealth = 250
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1436
				AddCaption(loc("Shield is fully recharged!"),0xa800ffff,capgrpMessage)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1437
			end
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  1438
			DrawTag(2)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1439
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1440
			OK = OK + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1441
			if OK == 3 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1442
				OK = 0
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
  1443
				AddCaption(loc("Shield Seeker!") .. " + 10 " .. loc("points") .. "!",0xffba00ff,capgrpMessage2)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1444
				AwardPoints(10)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1445
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1446
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1447
		elseif (vType[i] == "blueboss") then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1448
			PlaySound(sndHellishImpact3)
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1449
			AddCaption(loc("Boss defeated!") .. " +30 " .. loc("points") .. "!", 0x0050ffff,capgrpMessage)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1450
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1451
			morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1452
			SetHealth(morte, 0)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1453
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1454
			BK = BK + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1455
			if BK == 2 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1456
				BK = 0
5334
ce404661aac6 Fix some quirky syntax.
mikade
parents: 5332
diff changeset
  1457
				AddCaption(loc("Boss Slayer!") .. " +25 " .. loc("points") .. "!",0xffba00ff,capgrpMessage2)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1458
				AwardPoints(25)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1459
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1460
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1461
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1462
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1463
		AwardPoints(vCircScore[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1464
		AwardKills()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1465
		SetUpCircle(i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1466
		res = "fatal"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1467
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1468
		chainCounter = 3000
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1469
		chainLength = chainLength + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1470
		if chainLength > 1 then
5334
ce404661aac6 Fix some quirky syntax.
mikade
parents: 5332
diff changeset
  1471
			AddCaption( chainLength .. "-" .. loc("Hit Combo!") .. " +" .. chainLength*2 .. " " .. loc("points") .. "!",0xffba00ff,capgrpAmmostate)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1472
			AwardPoints(chainLength*2)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1473
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1474
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1475
	else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1476
	-- circle is merely damaged
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1477
	-- do damage effects/sounds
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1478
		AddVisualGear(vCircX[i], vCircY[i], vgtSteam, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1479
		r = GetRandom(4)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1480
		if r == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1481
			PlaySound(sndHellishImpact1)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1482
		elseif r == 1 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1483
			PlaySound(sndHellishImpact2)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1484
		elseif r == 2 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1485
			PlaySound(sndHellishImpact3)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1486
		elseif r == 3 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1487
			PlaySound(sndHellishImpact4)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1488
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1489
		res = "non-fatal"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1490
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1491
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1492
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1493
	return(res)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1494
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1495
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1496
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1497
function SetUpCircle(i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1498
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1499
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1500
	r = GetRandom(10)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1501
	--r = 8
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1502
	-- 80% of spawning either red/green
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1503
	if r <= 7 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1504
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1505
		--r = GetRandom(5)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1506
		r = GetRandom(2)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1507
		--r = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1508
		if r == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1509
		--if r <= 2 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1510
			vCircCol[i] = 0xff0000ff -- red
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1511
			vType[i] = "drone"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1512
			vCircRadMin[i] = 50	*5
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1513
			vCircRadMax[i] = 90	*5
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1514
			vCounterLim[i] = 3000
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1515
			vCircScore[i] = 10
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1516
			vCircHealth[i] = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1517
		--else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1518
		elseif r == 1 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1519
			vCircCol[i] = 0x00ff00ff -- green
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1520
			vType[i] = "ammo"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1521
			vCircRadMin[i] = 25	*7
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1522
			vCircRadMax[i] = 30	*7
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1523
			vCircScore[i] = 3
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1524
			vCircHealth[i] = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1525
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1526
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1527
	-- 20% chance of spawning boss or bonus
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1528
	else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1529
		r = GetRandom(5)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1530
		--r = GetRandom(2)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1531
		--r = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1532
		if r <= 1 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1533
		--if r == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1534
			vCircCol[i] = 0x0050ffff -- sexy blue
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1535
			vType[i] = "blueboss"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1536
			vCircRadMin[i] = 100*5
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1537
			vCircRadMax[i] = 180*5
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1538
			vCircWidth[i] = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1539
			vCounterLim[i] = 2000
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1540
			vCircScore[i] = 30
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1541
			vCircHealth[i] = 3
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1542
		else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1543
		--elseif r == 1 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1544
			--vCircCol[i] = 0xffae00ff -- orange
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1545
			vCircCol[i] = 0xa800ffff -- purp
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1546
			vType[i] = "bonus"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1547
			vCircRadMin[i] = 20 *7
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1548
			vCircRadMax[i] = 40 *7
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1549
			vCircScore[i] = 5
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1550
			vCircHealth[i] = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1551
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1552
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1553
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1554
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1555
	-- regenerate circle xy if too close to player or until sanity limit kicks in
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1556
	reN = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1557
	--zzz = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1558
	while (reN < 10) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1559
		if IGotMeASafeXYValue(i) == false then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1560
			reN = reN + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1561
			--zzz = zzz + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1562
		else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1563
			reN = 15
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1564
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1565
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1566
	--AddCaption("Took me this many retries: " .. zzz) -- number of times it took to work
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1567
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1568
	vCircRadius[i] = vCircRadMax[i] - GetRandom(vCircRadMin[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1569
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1570
	g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1571
	SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], vCircWidth[i], vCircCol[i]-0x000000ff)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1572
	-- - -0x000000ff
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1573
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1574
	g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(rCirc[i])
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1575
	SetVisualGearValues(rCirc[i], 0, 0, g3, g4, g5, g6, g7, g8, g9, vCircCol[i]-0x000000ff)
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1576
	
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1577
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1578
	vCircActive[i] = true -- new
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1579
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1580
	--nw WriteLnToConsole("CIRC " .. i .. ": X: " .. vCircX[i] .. "; Y: " .. vCircY[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1581
	--nw WriteLnToConsole("CIRC " .. i .. ": dX: " .. vCircDX[i] .. "; dY: " .. vCircDY[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1582
	--nw WriteLnToConsole("CIRC " .. i .. ": RAD:" .. vCircRadius[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1583
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1584
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1585
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1586
function SetMyCircles(s)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1587
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1588
	CirclesAreGo = s
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1589
	playerIsFine = s
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1590
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1591
	if s == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1592
		--nw WriteLnToConsole("About to set up all circles, old values are here:")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1593
		for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1594
			--nw WriteLnToConsole("CIRC " .. i .. ": X: " .. vCircX[i] .. "; Y: " .. vCircY[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1595
			--nw WriteLnToConsole("CIRC " .. i .. ": dX: " .. vCircDX[i] .. "; dY: " .. vCircDY[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1596
			--nw WriteLnToConsole("CIRC " .. i .. ": RAD:" .. vCircRadius[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1597
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1598
		--nw WriteLnToConsole("Old values given, new values to follow...")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1599
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1600
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1601
	for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1602
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1603
		if s == false then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1604
			--vCircCol[i] = 0xffffffff
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1605
			vCircActive[i] = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1606
		elseif s == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1607
			SetUpCircle(i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1608
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1609
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1610
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1611
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1612
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1613
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1614
function WellHeAintGonnaJumpNoMore(x,y)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1615
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1616
	AddVisualGear(x, y, vgtBigExplosion, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1617
	playerIsFine = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1618
	AddCaption(loc("GOTCHA!"))
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1619
	PlaySound(sndExplosion)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1620
	PlaySound(sndHellish)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1621
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1622
	targetHit = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1623
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1624
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1625
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1626
--- collision detection for weapons fire
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1627
function CheckVarious(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1628
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1629
	--if (GetGearType(gear) == gtExplosives) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1630
		--nw WriteLnToConsole("Start of CheckVarious(): Exp ID: " .. getGearValue(gear,"ID"))
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1631
	--elseif (GetGearType(gear) == gtShell) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1632
		--nw WriteLnToConsole("Start of CheckVarious(): Shell ID: " .. getGearValue(gear,"ID"))
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1633
	--end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1634
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1635
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1636
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1637
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1638
	targetHit = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1639
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1640
	-- if circle is hit by player fire
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1641
	if (GetGearType(gear) == gtExplosives) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1642
		circsHit = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1643
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1644
		for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1645
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1646
			--nw WriteLnToConsole("Is it neccessary to check for collision with circ " .. i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1647
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1648
			--if (vCircActive[i] == true) and ( (vType[i] == "drone") ) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1649
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1650
				--nw WriteLnToConsole("YES. about to calc distance between gtExplosives and circ " .. i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1651
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1652
				dist = GetDistFromGearToXY(gear, vCircX[i], vCircY[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1653
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1654
				-- calculate my real radius if I am an aura
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1655
				if vCircType[i] == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1656
					NR = vCircRadius[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1657
				else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1658
					NR = (48/100*vCircRadius[i])/2
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1659
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1660
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1661
				if dist <= NR*NR then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1662
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1663
						--nw WriteLnToConsole("Collision confirmed. The gtExplosives is within the circ radius!")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1664
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1665
					--SetGearPosition(gear, vCircX[i], vCircY[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1666
						--WriteLnToConsole("set the gtExplosives to be in the center of circ")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1667
					AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1668
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1669
					targetHit = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1670
					--DeleteGear(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1671
					--SetHealth(gear,0)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1672
						--WriteLnToConsole("set " .. "Exp ID: " .. getGearValue(gear,"ID") .. " health to 0")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1673
						--WriteLnToConsole("targetHit set to true, explosive is at distance " .. dist .. "(within range " .. NR*NR.. ") of circ" )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1674
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1675
					CircleDamaged(i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1676
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1677
					circsHit = circsHit + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1678
					if circsHit > 1 then
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1679
						AddCaption(loc("Multi-shot!") .. " +15 " .. loc("points") .. "!",0xffba00ff,capgrpAmmostate)
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1680
						AwardPoints(15)
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1681
						circsHit = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1682
					end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1683
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1684
					shotsHit = shotsHit + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1685
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1686
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1687
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1688
			--end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1689
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1690
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1691
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1692
	-- if player is hit by circle bazooka
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1693
	elseif (GetGearType(gear) == gtShell) or (GetGearType(gear) == gtBall) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1694
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1695
		dist = GetDistFromGearToGear(gear, CurrentHedgehog)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1696
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1697
		if beam == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1698
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1699
			if dist < 3000 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1700
				tempE = AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1701
				g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1702
				SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, 0xff00ffff )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1703
				PlaySound(sndVaporize)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1704
				DeleteGear(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1705
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1706
				SK = SK + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1707
				if SK == 5 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1708
					SK = 0
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
  1709
					AddCaption(loc("Shield Master!") .. " +10 " .. loc("points") .. "!",0xffba00ff,capgrpAmmoinfo)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1710
					AwardPoints(10)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1711
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1712
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1713
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1714
		elseif dist < 1600 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1715
			WellHeAintGonnaJumpNoMore(GetX(gear), GetY(gear))
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1716
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1717
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1718
		--[[if targetHit == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1719
			WriteLnToConsole("about to delete shell due to targetHit being set to true earlier")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1720
			DeleteGear(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1721
			WriteLnToConsole("there, I deleted it")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1722
		end]]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1723
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1724
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1725
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1726
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1727
	if targetHit == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1728
			--nw WriteLnToConsole("about to delete something due to targetHit being set to true earlier")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1729
			DeleteGear(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1730
			--nw WriteLnToConsole("there, I deleted it")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1731
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1732
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1733
	--nw WriteLnToConsole("End of CheckVarious()")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1734
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1735
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1736
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1737
-- collision detection for player entering a circle
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1738
function CheckDistances()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1739
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1740
	--nw WriteLnToConsole("Start of CheckDistances()")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1741
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1742
	for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1743
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1744
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1745
		--nw WriteLnToConsole("Attempting to calculate dist of circ " .. i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1746
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1747
		g1X, g1Y = GetGearPosition(CurrentHedgehog)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1748
		g2X, g2Y = vCircX[i], vCircY[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1749
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1750
		g1X = g1X - g2X
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1751
		g1Y = g1Y - g2Y
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1752
		dist = (g1X*g1X) + (g1Y*g1Y)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1753
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1754
		--DoHorribleThings(i, g1X, g1Y, g2X, g2Y, dist)
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1755
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1756
		--nw WriteLnToConsole("Calcs done. Dist to CurrentHedgehog is " .. dist)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1757
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1758
		-- calculate my real radius if I am an aura
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1759
		if vCircType[i] == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1760
			NR = vCircRadius[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1761
		else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1762
			NR = (48/100*vCircRadius[i])/2
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1763
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1764
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1765
		if dist <= NR*NR then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1766
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1767
			if 	(vCircActive[i] == true) and
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1768
				((vType[i] == "ammo") or (vType[i] == "bonus") )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1769
			then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1770
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1771
				CircleDamaged(i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1772
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1773
			elseif (vCircActive[i] == true) and
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1774
					( (vType[i] == "drone") or (vType[i] == "blueboss") )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1775
			then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1776
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1777
				ss = CircleDamaged(i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1778
				WellHeAintGonnaJumpNoMore(GetX(CurrentHedgehog),GetY(CurrentHedgehog))
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1779
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1780
				if ss == "fatal" then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1781
					if (primShotsLeft == 0) and (TimeLeft <= 9) then
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
  1782
						AddCaption(loc("Kamikaze Expert!") .. " +15 " .. loc("points") .. "!",0xffba00ff,capgrpMessage)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1783
						AwardPoints(15)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1784
					elseif (primShotsLeft == 0) then
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
  1785
						AddCaption(loc("Depleted Kamikaze!") .. " +5 " .. loc("points") .. "!",0xffba00ff,capgrpMessage)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1786
						AwardPoints(5)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1787
					elseif TimeLeft <= 9 then
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
  1788
						AddCaption(loc("Timed Kamikaze!") .. " +10 " .. loc("points") .. "!",0xffba00ff,capgrpMessage)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1789
						AwardPoints(10)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1790
					end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1791
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1792
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1793
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1794
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1795
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1796
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1797
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1798
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1799
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1800
	--nw WriteLnToConsole("End of CheckDistances()")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1801
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1802
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1803
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1804
function HandleCircles()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1805
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1806
	--[[if CirclesAreGo == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1807
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1808
		--CheckDistances()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1809
		--runOnGears(CheckVarious)	-- used to be in handletracking for some bizarre reason
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1810
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1811
		--pTimer = pTimer + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1812
		--if pTimer == 100 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1813
		--	pTimer = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1814
		--	runOnGears(ProjectileTrack)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1815
		--end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1816
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1817
	end]]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1818
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1819
	
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1820
	if rAlpha ~= 255 then
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1821
		
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1822
		rPingTimer = rPingTimer + 1
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1823
		if rPingTimer == 100 then
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1824
			rPingTimer = 0	
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1825
			
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1826
			rAlpha = rAlpha + 5
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1827
			if rAlpha >= 255 then
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1828
				rAlpha = 255
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1829
			end	
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1830
		end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1831
	
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1832
	end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1833
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1834
	for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1835
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1836
		--if (vCircActive[i] == true) then
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1837
			SetVisualGearValues(rCirc[i], rCircX[i], rCircY[i], 100, 255, 1, 10, 0, 40, 3, vCircCol[i]-rAlpha)	
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1838
		--end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1839
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1840
		vCounter[i] = vCounter[i] + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1841
		if vCounter[i] >= vCounterLim[i] then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1842
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1843
			vCounter[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1844
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1845
			if 	((vType[i] == "drone") or (vType[i] == "blueboss") ) and
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1846
				(vCircActive[i] == true) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1847
				AddGear(vCircX[i], vCircY[i], gtShell, 0, 0, 0, 1)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1848
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1849
				--WriteLnToConsole("Circle " .. i .. " just fired/added a gtShell")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1850
				--WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1851
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1852
			--elseif (vType[i] == "bluebottle") and (vCircActive[i] == true) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1853
			--	AddGear(vCircX[i], vCircY[i]-vCircRadius[i], gtBall, 0, 0, 0, 1)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1854
			--	AddGear(vCircX[i], vCircY[i]+vCircRadius[i], gtBall, 0, 0, 0, 1)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1855
			--	AddGear(vCircX[i]-vCircRadius[i], vCircY[i], gtBall, 0, 0, 0, 1)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1856
			--	AddGear(vCircX[i]+vCircRadius[i], vCircY[i], gtBall, 0, 0, 0, 1)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1857
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1858
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1859
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1860
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1861
		if (vCircActive[i] == true) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1862
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1863
			vCircRadCounter[i] = vCircRadCounter[i] + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1864
			if vCircRadCounter[i] == 100 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1865
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1866
				vCircRadCounter[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1867
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1868
				-- make my radius increase/decrease faster if I am an aura
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1869
				if vCircType[i] == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1870
					M = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1871
				else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1872
					M = 10
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1873
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1874
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1875
				vCircRadius[i] = vCircRadius[i] + vCircRadDir[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1876
				if vCircRadius[i] > vCircRadMax[i] then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1877
					vCircRadDir[i] = -M
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1878
				elseif vCircRadius[i] < vCircRadMin[i] then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1879
					vCircRadDir[i] = M
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1880
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1881
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1882
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1883
				-- random effect test
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1884
				-- maybe use this to tell the difference between circs
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1885
				-- you can kill by shooting or not
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1886
				--vgtSmoke vgtSmokeWhite
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1887
				--vgtSteam -- nice long trail
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1888
				--vgtDust -- short trail on earthrise
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1889
				--vgtSmokeTrace
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1890
				if vType[i] == "ammo" then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1891
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1892
					tempE = AddVisualGear(vCircX[i], vCircY[i], vgtSmoke, 0, true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1893
					g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)	--0xff00ffff	--0x00ff00ff
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1894
					SetVisualGearValues(tempE, vCircX[i], vCircY[i], g3, g4, g5, g6, g7, g8, g9, vCircCol[i] )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1895
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1896
					--AddVisualGear(vCircX[i], vCircY[i], vgtDust, 0, true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1897
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1898
				elseif vType[i] == "bonus" then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1899
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1900
					tempE = AddVisualGear(vCircX[i], vCircY[i], vgtDust, 0, true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1901
					g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)	--0xff00ffff	--0x00ff00ff --vCircCol[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1902
					SetVisualGearValues(tempE, vCircX[i], vCircY[i], g3, g4, g5, g6, g7, 1, g9, 0xff00ffff )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1903
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1904
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1905
				elseif vType[i] == "blueboss" then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1906
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1907
					k = 25
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1908
					g = vgtSteam
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1909
					trailColour = 0xae00ffff
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1910
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1911
					-- 0xffae00ff -- orange
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1912
					-- 0xae00ffff -- purp
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1913
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1914
					tempE = AddVisualGear(vCircX[i], vCircY[i], g, 0, true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1915
					g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)	--0xff00ffff	--0x00ff00ff
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1916
					SetVisualGearValues(tempE, vCircX[i], vCircY[i]+k, g3, g4, g5, g6, g7, g8, g9, trailColour-75 )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1917
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1918
					tempE = AddVisualGear(vCircX[i], vCircY[i], g, 0, true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1919
					g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)	--0xff00ffff	--0x00ff00ff
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1920
					SetVisualGearValues(tempE, vCircX[i]+k, vCircY[i]-k, g3, g4, g5, g6, g7, g8, g9, trailColour-75 )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1921
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1922
					tempE = AddVisualGear(vCircX[i], vCircY[i], g, 0, true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1923
					g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)	--0xff00ffff	--0x00ff00ff
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1924
					SetVisualGearValues(tempE, vCircX[i]-k, vCircY[i]-k, g3, g4, g5, g6, g7, g8, g9, trailColour-75 )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1925
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1926
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1927
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1928
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1929
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1930
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1931
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1932
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1933
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1934
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1935
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1936
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1937
	-- alter the circles velocities
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1938
	circAdjustTimer = circAdjustTimer + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1939
	if circAdjustTimer == 2000 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1940
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1941
		circAdjustTimer = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1942
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1943
		for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1944
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1945
			-- bounce the circles off the edges if they go too far
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1946
			-- or make them move in random directions
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1947
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1948
			if vCircX[i] > 5500 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1949
				vCircDX[i] = -5	--5 circmovchange
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1950
			elseif vCircX[i] < -1500 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1951
				vCircDX[i] = 5	--5 circmovchange
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1952
			else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1953
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1954
				z = GetRandom(2)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1955
				if z == 1 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1956
					z = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1957
				else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1958
					z = -1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1959
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1960
				vCircDX[i] = vCircDX[i] + GetRandom(3)*z	--3 circmovchange
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1961
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1962
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1963
			if vCircY[i] > 1500 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1964
				vCircDY[i] = -5	--5 circmovchange
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1965
			elseif vCircY[i] < -2900 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1966
				vCircDY[i] = 5	--5 circmovchange
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1967
			else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1968
				z = GetRandom(2)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1969
				if z == 1 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1970
					z = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1971
				else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1972
					z = -1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1973
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1974
				vCircDY[i] = vCircDY[i] + GetRandom(3)*z	--3 circmovchange
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1975
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1976
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1977
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1978
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1979
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1980
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1981
	-- move the circles according to their current velocities
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1982
	m2Count = m2Count + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1983
	if m2Count == 25 then	--25 circmovchange
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1984
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1985
		m2Count = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1986
		for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1987
			vCircX[i] = vCircX[i] + vCircDX[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1988
			vCircY[i] = vCircY[i] + vCircDY[i]
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1989
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1990
			if (CurrentHedgehog ~= nil) and (rAlpha ~= 255) then			
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1991
				DoHorribleThings(i)--(i, g1X, g1Y, g2X, g2Y, dist)				
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1992
			end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1993
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1994
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1995
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1996
		if (TimeLeft == 0) and (tumbleStarted == true) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1997
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1998
			FadeAlpha = FadeAlpha + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1999
			if FadeAlpha >= 255 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2000
				FadeAlpha = 255
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2001
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2002
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  2003
			--new
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2004
			--if FadeAlpha == 1 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  2005
			--	AddCaption("GOT IT")
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2006
			--	for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2007
			--		g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i])
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  2008
			--		vCircCol[i] = g10
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2009
			--	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2010
			--end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2011
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2012
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2013
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2014
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2015
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2016
	for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2017
		g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i])		-- vCircCol[i] g10
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2018
		SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], g9, g10)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2019
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2020
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2021
	if 	(TimeLeft == 0) or
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2022
		((tumbleStarted == false)) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2023
		for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2024
			g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i])		-- vCircCol[i] g10
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2025
			SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], g9, (vCircCol[i]-FadeAlpha))
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2026
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2027
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2028
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2029
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2030
	if (CurrentHedgehog ~= nil) and (beam == true) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2031
		g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(pShield)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2032
		--SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, 200, g9, g10 )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2033
		SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, 200, g9, 0xa800ffff-0x000000ff - -shieldHealth )
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  2034
		DrawTag(2)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2035
	else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2036
		SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, 0, g9, g10 )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2037
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2038
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2039
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2040
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2041
function ProjectileTrack(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2042
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2043
	if (GetGearType(gear) == gtShell) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2044
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2045
		--nw WriteLnToConsole("ProjectileTrack() for Shell ID: " .. getGearValue(gear,"ID"))
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2046
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2047
		-- newnew
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2048
		if (GetGearType(gear) == gtShell) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2049
			turningSpeed = 0.1*fMod
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2050
		--elseif (GetGearType(gear) == gtBall) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2051
		--	turningSpeed = 0.2*fMod
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2052
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2053
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2054
		dx, dy = GetGearVelocity(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2055
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2056
		--WriteLnToConsole("I'm trying to track currenthedge with shell ID: " .. getGearValue(gear,"ID"))
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2057
		--WriteLnToConsole("I just got the velocity of the shell. It is dx: " .. dx .. "; dy: " .. dy)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2058
		--WriteLnToConsole("CurrentHedgehog is at X: " .. GetX(CurrentHedgehog) .. "; Y: " .. GetY(CurrentHedgehog) )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2059
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2060
		if GetX(gear) > GetX(CurrentHedgehog) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2061
			dx = dx - turningSpeed--0.1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2062
		else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2063
			dx = dx + turningSpeed--0.1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2064
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2065
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2066
		if GetY(gear) > GetY(CurrentHedgehog) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2067
			dy = dy - turningSpeed--0.1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2068
		else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2069
			dy = dy + turningSpeed--0.1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2070
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2071
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2072
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2073
		if (GetGearType(gear) == gtShell) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2074
			dxlimit = 0.4*fMod
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2075
			dylimit = 0.4*fMod
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2076
		--elseif (GetGearType(gear) == gtBall) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2077
		--	dxlimit = 0.5	--  0.5 is about the same
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2078
		--	dylimit = 0.5 -- 0.6 is faster than player
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2079
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2080
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2081
		if dx > dxlimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2082
			dx = dxlimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2083
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2084
		if dy > dylimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2085
			dy = dylimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2086
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2087
		if dx < -dxlimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2088
			dx = -dxlimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2089
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2090
		if dy < -dylimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2091
			dy = -dylimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2092
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2093
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2094
		SetGearVelocity(gear, dx, dy)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2095
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2096
		--WriteLnToConsole("I just SET the velocity of shell towards currenthegdge. It is now dx: " .. dx .. "; dy: " .. dy)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2097
		--WriteLnToConsole("The above events occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2098
		--nw WriteLnToConsole("ProjectileTrack() finished successfully")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2099
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2100
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2101
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2102
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2103