share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua
author Wuzzy <almikes@aol.com>
Thu, 24 Nov 2016 03:36:56 +0100
changeset 12059 0e6f044daeac
parent 10670 638af9cb922b
child 12060 ddf0fee75449
permissions -rw-r--r--
Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
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
8043
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7838
diff changeset
     2
HedgewarsScriptLoad("/Scripts/Locale.lua")
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7838
diff changeset
     3
HedgewarsScriptLoad("/Scripts/Tracker.lua")
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
     4
HedgewarsScriptLoad("/Scripts/Params.lua")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
     5
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
     6
--[[
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
     7
Space Invasion 1.2
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
     8
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
     9
=== DOCUMENTATION ===
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    10
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    11
== SCRIPT CONFIGURATION ==
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    12
You can configure this script a little bit, you only have to edit the game scheme.
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    13
The script makes heavy use of the script parameters, but you can also use some,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    14
but not all, of the other settings in a game scheme.
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    15
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    16
You CAN use the following options:
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    17
- disable girders (highly recommended!)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    18
- disable land objects
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    19
- random order
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    20
- solid land
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    21
- low gravity (makes this game much easier, but this script is probably not optimized for it yet)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    22
- bottom border
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    23
- fort mode (just changes the landscape)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    24
- teams start at opposite parts of land
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    25
- wind affects almost everything
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    26
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    27
Those options are also possible, but have no real gameplay effect:
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    28
- disable wind
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    29
- tag team
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    30
- king mode (here it only changes hats, so this is just for fun)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    31
- vampiric (has no real gameplay effect; just for the grapical effect)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    32
- full border (it’s techincally possible, but the script is currently not very well optimized for this mode)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    33
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    34
You CANNOT use any other of the on/off options in the game scheme. Those settings are simply discarded by the script.
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    35
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    36
You also can change the following settings in the game scheme
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    37
- time per round (very important)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    38
- script parameters, see below
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    39
- terrain edge other than none (they kinda work, but they aren’t well supported by the script either)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    40
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    41
The other settings are technically possible, but their effect is limited:
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    42
- damage percentage
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    43
- mines (they don’t harm the active hedgehog, however)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    44
- number of barrels
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    45
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    46
All other variables are discarded, the script forces its own settings.
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    47
There will be never Sudden Death, any crate drops, any mines and any
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    48
barrels.
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    49
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    50
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    51
== SCRIPT PARAMETERS ==
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    52
This script can be configured mostly with the script parameters.
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    53
The script parameters are specified in a key=value format each,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    54
and each pair is delimeted by a comma.
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    55
All values must be integer of 0 or higher. All values are optional
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    56
and have a default if unspecified
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    57
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    58
List of parameters:
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    59
- rounds: Number of rounds (default: 3)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    60
- shield: Amount of shield you start with (default: 30)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    61
- barrels: Amount of ammo (barrels) you start with (default: 5)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    62
- pings: How many time you can use the radar per round (default: 2)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    63
- barrelbonus: How many barrels you get for collecting/destroning a green invader (default: 3)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    64
- shieldbonus: How much shield you get for collecting/destroying a purple invader (default: 30)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    65
- timebonus: How many seconds you get for killing a drone (red) (default: 4)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    66
- forcetheme: If set to false, the game will use your chosen theme instead of forcing EarthRise
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    67
-             Please note that the game may not be able to be played in some themes if the sky
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    68
               color is very bright (i.e. Bath)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    69
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    70
Example input for the field “Script parameters”:
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    71
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    72
rounds=5
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    73
>>> 5 rounds, everything else is default
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    74
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    75
forcetheme=false
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    76
>>> Makes the game use whatever thme
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    77
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    78
shield=0, barrels=3, pings=0
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    79
>>> no shield, no radar pings and only 3 barrels (could be some hard mode)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    80
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    81
(empty string)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    82
>>> Use defaults for everything
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    83
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    84
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    85
-- VERSION HISTORY
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    86
----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    87
-- version 0.1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    88
----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    89
-- conversion of tumbler into space invasion
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    90
-- a million and one changes
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    91
-- bells and whistles
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    92
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    93
----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    94
-- version 0.2
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    95
----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    96
-- 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
    97
-- lots of console tracking :/
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    98
-- 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
    99
-- 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
   100
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   101
----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   102
-- version 0.3
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   103
----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   104
-- 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
   105
-- 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
   106
-- 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
   107
-- 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
   108
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   109
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   110
--0.4
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   111
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   112
-- 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
   113
-- added some different WriteLnToConsoles
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   114
-- 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
   115
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   116
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   117
--0.5
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   118
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   119
-- added implementation for a projectile shield
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   120
-- 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
   121
-- added a tough "blueboss" blue invader
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   122
-- expanded user feedback
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   123
-- 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
   124
-- 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
   125
-- added more sounds to events
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   126
-- added more visual gears
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
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   129
--0.6
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
-- removed a few WriteLns
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   132
-- added randomized grunts on circ damage
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   133
-- added (mostly) graceful fading out of circles :D:
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   134
-- changed odds for circles
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   135
-- changed user feedback
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   136
-- 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
   137
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   138
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   139
--0.7
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   140
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   141
-- added PlaySound(sndSuddenDeath) when ammo gets depleted
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   142
-- 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
   143
-- 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
   144
-- 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
   145
-- 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
   146
-- 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
   147
-- 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
   148
-- utilized the improved AddCaption to tint / prevent overrides
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   149
-- 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
   150
-- 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
   151
-- standarized point notation
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   152
-- added some missing locs
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   153
-- 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
   154
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   155
-- ACHIEIVEMENTS added
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   156
-- (during one turn) aka repeatable
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   157
-- 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
   158
-- 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
   159
-- 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
   160
-- 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
   161
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   162
-- Shield Master (disolve 5 shells for +10 points)
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   163
-- Shield Miser (don't use your shield at all (3.5*roundkills)+2 points)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   164
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   165
-- 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
   166
-- 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
   167
-- Kamikaze Expert (combination of the above two) 15pts
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   168
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   169
-- 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
   170
-- 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
   171
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   172
-- 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
   173
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   174
--(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
   175
-- 10/25/50 kills (+25/+50/+100 points)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   176
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   177
-----------------
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   178
--0.8
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   179
-----------------
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   180
-- added a HUD for turntimeleft, ammo, shield
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   181
-- shieldhealth hits 0 properly
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   182
5825
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   183
------------------------
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   184
-- version 0.8.1
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   185
------------------------
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   186
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   187
-- stop hiding non-existant 4th Tag
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   188
-- redraw HUD on screen resolution change
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   189
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   190
------------------------
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   191
-- version 0.9
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   192
------------------------
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   193
-- 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
   194
-- (hopefully) balanced Shield Miser
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   195
-- 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
   196
-- 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
   197
-- bugfix and balance for multishot
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   198
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   199
------------------------
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   200
-- version 1.0
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   201
------------------------
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   202
-- if only version numbers actually worked like this, wouldn't that be awful :D
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   203
-- added surfer achievement
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   204
-- increased value of shield miser by 1 point per kill (OP?)
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   205
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   206
------------------------
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   207
-- version 1.1
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   208
------------------------
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   209
-- fixed radar so that blips dont go past circs when you get very close
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   210
-- added a missing loc for shield depletion
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   211
-- increased delay to 1000 to try stop noobies missing their turn
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   212
-- added sniper achievement for hits from over a 1000000 away
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   213
-- added achievement for 3 "sniper" shots in a round
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   214
-- added achievement for 3 "point blank" shots in a round
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   215
-- added "fierce Competition" achievement for shooting an enemy hog (once per round)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   216
-- some support for more weapons later
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   217
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   218
------------------------
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   219
-- version 1.2
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   220
------------------------
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   221
-- show actual scores in stats screen
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   222
-- show a couple of “awards” and more or less snarky comments in stats screen
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   223
--  for various accomplisments and events those are just for fun, they don’t
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   224
--  affect score or game outcome
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   225
-- use script parameters for configuration, see top of file for more information
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   226
-- stop overwriting game most scheme’s parameters
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   227
-- disable weapon scheme
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   228
-- play “denied” sound when trying to use empty radar, ammo or shield
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   229
-- play “Hurry!” taunt when 5 seconds are left
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   230
-- play throw sound when throwing a barrel
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   231
-- play sonar sound for using radar
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   232
-- play “Kamikaze!” taunt for receiving one of the kamikaze bonuses
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   233
-- show total team score in HUD (white number)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   234
-- show message when trying to use empty radar
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   235
-- show message when time’s up
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   236
-- show message with round score at end of a round
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   237
-- disabled health graph, replaced with score per round
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   238
-- removed “selected weapon” message, we only have one weapon
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   239
-- removed unused bubbleSort function
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   240
-- play “Ooff” sound when hit by bazooka
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   241
-- fix explosion being drawn twice when colliding with circle
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   242
-- play explosion sound when barrel’s lifespan is over
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   243
]]
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   244
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   245
--------------------------
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   246
-- TODO list: notes for later
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   247
--------------------------
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   248
-- imitate winning animation at end instead of just ending the game
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   249
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   250
-- maybe add a check for a tie, IMPOSSIBRU THERE ARE NO TIES
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   251
-- more achievements?
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   252
-- more just-for-fun awards (for stats screen)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   253
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   254
-- if more weps are added, replace primshotsfired all over the place
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   255
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   256
-- look for derp and let invaders shoot again
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   257
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   258
-- more weps? flamer/machineballgun,
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   259
-- some kind of bomb that just drops straight down
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   260
-- "fire and forget" missile
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   261
-- shockwave
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   262
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   263
-- some kind of ability-meter that lets you do something awesome when you are
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   264
-- doing really well in a given round.
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   265
-- probably new kind of shield that pops any invaders who come near
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   266
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   267
-- fix game never ending bug
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   268
-- fix radar
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   269
-- new invader: golden snitch, doesn't show up on your radar
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   270
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   271
-- maybe replace (48/100*vCircRadius[i])/2 with something better
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   272
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   273
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   274
------- CODE FOLLOWS -------
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   275
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   276
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   277
--[[CAPTION CATEGORIES
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   278
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   279
capgrpGameState
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   280
-----------------
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   281
AddCaption(LOC_NOT("Sniper!") .. " +10 " .. LOC_NOT("points") .. "!",0xffba00ff,capgrpAmmostate)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   282
--they call me bullsye
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   283
--point blank combo
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   284
--fierce Competition
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   285
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   286
capgrpAmmostate
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   287
-----------------
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
   288
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
   289
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
   290
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   291
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   292
capgrpAmmoinfo
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   293
-----------------
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
   294
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
   295
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
   296
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   297
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   298
capgrpVolume
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   299
-----------------
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
   300
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
   301
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
   302
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
   303
AddCaption(LOC_NOT("Accuracy Bonus! +15 points!"),0xffba00ff,capgrpVolume)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   304
AddCaption(LOC_NOT("Surfer! +15 points!"),0xffba00ff,capgrpVolume)
5245
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
-----------------
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   307
capgrpMessage
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   308
-----------------
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
   309
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
   310
AddCaption(LOC_NOT("Ammo: ") .. primShotsLeft)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   311
AddCaption(LOC_NOT("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
   312
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
   313
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
   314
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
   315
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
   316
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
   317
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
   318
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
   319
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
   320
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
   321
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
   322
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
   323
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
   324
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
   325
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   326
-----------------
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   327
capgrpMessage2
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   328
-----------------
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
   329
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
   330
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
   331
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
   332
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
   333
]]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   334
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   335
----------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   336
-- so I herd u liek wariables
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   337
----------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   338
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   339
--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
   340
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
   341
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   342
-- some console stuff
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   343
local shellID = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   344
local explosivesID = 0
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
   345
local luaGameTicks = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   346
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   347
-- gaudyRacer
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   348
local boosterOn = false
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   349
local roundLimit = 3		-- can be overridden by script parameter "rounds"
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   350
local roundNumber = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   351
local firstClan = 10
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   352
local gameOver = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   353
local gameBegun = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   354
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   355
local bestClan = 10
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   356
local bestScore = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   357
local sdScore = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   358
local sdName = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   359
local sdKills = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   360
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   361
local roundN = 0
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   362
local lastRound
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   363
local RoundHasChanged = true
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   364
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   365
-- for script parameters
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   366
local startBarrels = 5		-- "barrels"
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   367
local startShield = 30		-- "shield"
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   368
local startRadShots = 2		-- "pings"
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   369
local shieldBonus = 30		-- "shieldbonus"
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   370
local barrelBonus = 3		-- "barrelbonus"
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   371
local timeBonus = 4		-- "timebonus"
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   372
local forceTheme = true		-- "forcetheme"
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   373
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   374
--------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   375
-- hog and team tracking variales
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   376
--------------------------
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
local numhhs = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   379
local hhs = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   380
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   381
local numTeams
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   382
local teamNameArr = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   383
local teamClan = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   384
local teamSize = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   385
local teamIndex = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   386
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   387
local teamScore = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   388
local teamCircsKilled = {}
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   389
local teamSurfer = {}
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   390
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   391
-- stats variables
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   392
--local teamRed = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   393
--local teamBlue = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   394
--local teamOrange = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   395
--local teamGreen = {}
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   396
local roundKills = 0
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   397
local roundScore = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   398
local RK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   399
local GK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   400
local BK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   401
local OK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   402
local SK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   403
local shieldMiser = true
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   404
local fierceComp = false
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   405
local chainCounter = 0
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   406
local chainLength = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   407
local shotsFired = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   408
local shotsHit = 0
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   409
local sniperHits = 0
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   410
local pointBlankHits = 0
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   411
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   412
---------------------
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   413
-- awards (for stats section, just for fun)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   414
---------------------
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   415
-- global awards
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   416
local awardTotalKills=0	-- overall killed invaders (min. 30)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   417
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   418
-- TODO: team awards (currently unused)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   419
local awardBoss 	-- most boss kills (min. 3)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   420
local awardKamikaze	-- most kamikaze bonuses (min. 3)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   421
local awardSniper	-- most sniper shots (min. 3)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   422
local awardAbsorber	-- most absorbed (with shield) projectiles (min. 20)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   423
local awardFierceComps	-- most fierce competition achievements
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   424
local awardNoShield	-- no shield used in entire game (if there are multiple teams, award goes to team with most kills)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   425
local awardCollector	-- most ammo and shield invaders collected
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   426
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   427
-- hog awards
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   428
local awardRoundScore	-- hog with most score in 1 round (min. 50)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   429
local awardRoundKills	-- most kills in 1 round (min. 5)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   430
local awardAccuracy	-- awarded to hog who didn’t miss once in his round, with most kills (min. 5)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   431
local awardCombo	-- hog with longest combo (min. 5)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   432
5245
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
-- tumbler goods
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   435
---------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   436
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
   437
local moveTimer = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   438
local leftOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   439
local rightOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   440
local upOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   441
local downOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   442
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   443
----------------
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   444
-- TUMBLER
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   445
local wep = {}
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   446
local wepAmmo = {}
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   447
local wepCol = {}
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   448
local wepIndex = 0
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   449
local wepCount = 0
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   450
local fireTimer = 0
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   451
----------------
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   452
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   453
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   454
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   455
local primShotsMax = 5
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   456
local primShotsLeft = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   457
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
   458
local TimeLeftCounter = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   459
local TimeLeft = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   460
local stopMovement = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   461
local tumbleStarted = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   462
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   463
local beam = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   464
local pShield
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   465
local shieldHealth
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   466
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   467
local shockwave
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   468
local shockwaveHealth = 0
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   469
local shockwaveRad = 300
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   470
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
   471
local Timer100 = 0
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
   472
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   473
local vTag = {}
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   474
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
-- CIRCLY GOODIES
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
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   479
local CirclesAreGo = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   480
local playerIsFine = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   481
local targetHit = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   482
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   483
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
   484
local pTimer = 0 -- tracking projectiles following player
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   485
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
   486
local circAdjustTimer = 0		-- handle adjustment of circs direction
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
   487
local m2Count = 0		-- handle speed of circs
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   488
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   489
local vCirc = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   490
local vCCount = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   491
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   492
local rCirc = {}
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   493
local rCircX = {}
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   494
local rCircY = {}
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   495
local rAlpha = 255
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
   496
local rPingTimer = 0
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   497
local radShotsLeft = 0
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   498
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   499
local vCircActive = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   500
local vCircHealth = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   501
local vType = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   502
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
   503
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
   504
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
   505
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   506
local vCircRadMax = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   507
local vCircRadMin = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   508
local vCircRadDir = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   509
local vCircRadCounter = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   510
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   511
local vCircDX = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   512
local vCircDY = {}
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
local vCircX = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   515
local vCircY = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   516
local vCircMinA = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   517
local vCircMaxA = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   518
local vCircType = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   519
local vCircPulse = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   520
local vCircFuckAll = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   521
local vCircRadius = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   522
local vCircWidth = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   523
local vCircCol = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   524
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   525
-------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   526
-- some lazy copypasta/modified methods
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   527
-------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   528
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   529
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   530
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   531
function HideTags()
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   532
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   533
	for i = 0, 4 do
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   534
		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
   535
	end
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   536
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   537
end
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   538
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   539
function DrawTag(i)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   540
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   541
	local zoomL = 1.3
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   542
	local xOffset = 40
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   543
	local yOffset, tValue, tCol
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   544
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   545
	if i == 0 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   546
		yOffset = 40
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   547
		tCol = 0xffba00ff
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   548
		tValue = TimeLeft
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   549
	elseif i == 1 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   550
		zoomL = 1.1
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   551
		yOffset = 70
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   552
		tCol = 0x00ff00ff
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   553
		tValue = wepAmmo[wepIndex] --primShotsLeft
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   554
	elseif i == 2 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   555
		zoomL = 1.1
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   556
		xOffset = 40 + 35
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   557
		yOffset = 70
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   558
		tCol = 0xa800ffff
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   559
		tValue = shieldHealth - 80
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   560
	elseif i == 4 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   561
		zoomL = 1.1
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   562
		xOffset = 40 + 80
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   563
		yOffset = 70
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   564
		tCol = 0xffffffff
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   565
		tValue = roundScore
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   566
	end
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   567
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   568
	DeleteVisualGear(vTag[i])
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   569
	vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   570
	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
   571
	SetVisualGearValues	(
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   572
				vTag[i], 		--id
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   573
				-(ScreenWidth/2) + xOffset,	--xoffset
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   574
				ScreenHeight - yOffset, --yoffset
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   575
				0, 			--dx
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   576
				0, 			--dy
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   577
				zoomL, 			--zoom
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   578
				1, 			--~= 0 means align to screen
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   579
				g7, 			--frameticks
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   580
				tValue, 		--value
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   581
				240000, 		--timer
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   582
				tCol		--GetClanColor( GetHogClan(CurrentHedgehog) )
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   583
				)
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   584
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   585
end
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   586
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   587
function RebuildTeamInfo()
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
	-- make a list of individual team names
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   590
	for i = 0, (TeamsCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   591
		teamNameArr[i] = " " -- = i
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   592
		teamSize[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   593
		teamIndex[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   594
		teamScore[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   595
		teamCircsKilled[i] = 0
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   596
		teamSurfer[i] = false
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   597
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   598
	numTeams = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   599
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   600
	for i = 0, (numhhs-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   601
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   602
		z = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   603
		unfinished = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   604
		while(unfinished == true) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   605
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   606
			newTeam = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   607
			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
   608
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   609
			if tempHogTeamName == teamNameArr[z] then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   610
				newTeam = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   611
				unfinished = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   612
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   613
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   614
			z = z + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   615
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   616
			if z == (TeamsCount-1) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   617
				unfinished = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   618
				if newTeam == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   619
					teamNameArr[numTeams] = tempHogTeamName
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   620
					numTeams = numTeams + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   621
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   622
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   623
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   624
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   625
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   626
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   627
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   628
	-- 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
   629
	for i = 0, (TeamsCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   630
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   631
		for z = 0, (numhhs-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   632
			if GetHogTeamName(hhs[z]) == teamNameArr[i] then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   633
				teamClan[i] = GetHogClan(hhs[z])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   634
				if teamSize[i] == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   635
					teamIndex[i] = z -- should give starting index
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   636
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   637
				teamSize[i] = teamSize[i] + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   638
				--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
   639
			end
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
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   643
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   644
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   645
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   646
-- control
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   647
function AwardPoints(p)
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   648
	roundScore = roundScore + p
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   649
	DrawTag(4)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   650
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   651
	for i = 0,(TeamsCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   652
		if teamClan[i] == GetHogClan(CurrentHedgehog) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   653
			teamScore[i] = teamScore[i] + p
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
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   656
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   657
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   658
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   659
function AwardKills(t)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   660
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   661
	roundKills = roundKills + 1
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   662
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   663
	for i = 0,(TeamsCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   664
		if teamClan[i] == GetHogClan(CurrentHedgehog) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   665
			teamCircsKilled[i] = teamCircsKilled[i] + 1
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   666
			awardTotalKills = awardTotalKills + 1
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   667
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   668
--[[
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   669
TODO: Check if I actually want to remove this
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   670
			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
   671
				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
   672
				AwardPoints(25)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   673
			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
   674
				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
   675
				AwardPoints(50)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   676
			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
   677
				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
   678
				AwardPoints(100)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   679
			end
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   680
]]
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   681
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   682
			--[[
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   683
			if t == "R" then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   684
				redCircsKilled[i] = redCircsKilled[i] + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   685
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   686
			--etc
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   687
			--etc
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   688
			]]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   689
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   690
	end
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
end
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
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   695
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   696
function UpdateSimpleAward(oldAward, value, threshold)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   697
	local awarded = false
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   698
	local newAward
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   699
	if oldAward == nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   700
		if threshold == nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   701
			awarded = true
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   702
		elseif value > threshold then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   703
			awarded = true
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   704
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   705
	elseif value > oldAward.value then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   706
		if threshold == nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   707
			awarded = true
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   708
		elseif value > threshold then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   709
			awarded = true
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   710
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   711
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   712
	if awarded then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   713
		newAward = {
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   714
			hogName = GetHogName(CurrentHedgehog),
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   715
			teamName = GetHogTeamName(CurrentHedgehog),
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   716
			value = value
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   717
		}
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   718
	else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   719
		newAward = oldAward
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   720
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   721
	return newAward
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   722
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   723
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   724
function CommentOnScore()
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   725
	local teamStats = {}
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   726
	for i = 0,(TeamsCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   727
		sdScore[i] = teamScore[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   728
		sdKills[i] = teamCircsKilled[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   729
		sdName[i] = teamNameArr[i]
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   730
		table.insert(teamStats, {score = teamScore[i], kills = teamCircsKilled[i], name = teamNameArr[i]})
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   731
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   732
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   733
	local scorecomp = function (v1, v2)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   734
		if v1.score > v2.score then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   735
			return true
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   736
		else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   737
			return false
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   738
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   739
	end
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   740
	table.sort(teamStats, scorecomp)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   741
	local teamComment = {}
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   742
	for i = TeamsCount,1,-1 do
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   743
		local comment
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   744
		if teamStats[i].name ~= " " then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   745
			local comment = teamStats[i].name .. " |" ..
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   746
			string.format(loc("Score: %d points"), teamStats[i].score) .. "|" ..
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   747
			string.format(loc("Kills: %d invaders destroyed"), teamStats[i].kills) .. "|" ..
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   748
			" " .. "|"
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   749
			table.insert(teamComment, comment)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   750
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   751
			SendStat(siClanHealth, tostring(teamStats[i].score), teamStats[i].name)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   752
		else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   753
			comment = "|"
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   754
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   755
		table.insert(teamComment, comment)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   756
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   757
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   758
	local entireC = ""
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   759
	for i = TeamsCount,1,-1 do
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   760
		entireC = entireC .. teamComment[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   761
	end
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   762
	local statusText, scoreText
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   763
	if roundNumber >= roundLimit then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   764
		if teamStats[1].score == teamStats[2].score then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   765
			statusText = loc("Status Update")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   766
			scoreText = loc("Team scores:")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   767
		else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   768
			statusText = loc("Game over!")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   769
			scoreText = loc("Final team scores:")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   770
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   771
	else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   772
		statusText = loc("Status Update")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   773
		scoreText = loc("Team scores:")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   774
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   775
	ShowMission(	loc("Space Invasion"),
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   776
			statusText,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   777
			string.format(loc("Rounds complete: %d/%d"), roundNumber, roundLimit) .. "| " .. "|" ..
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   778
			scoreText .. " |" ..entireC, 4, 1)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   779
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   780
	if roundNumber >= roundLimit then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   781
		local winnerTeam = teamStats[1].name
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   782
		local victorySoundPlayed = false
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   783
		for i = 0, (numhhs-1) do
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   784
			if GetHogTeamName(hhs[i]) == winnerTeam then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   785
				if not victorySoundPlayer then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   786
					PlaySound(sndVictory, hhs[i])
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   787
					victorySoundPlayed = true
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   788
				end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   789
				SetState(hhs[i], bor(GetState(hhs[i]), gstWinner))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   790
			end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   791
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   792
		AddCaption(string.format("%s wins!", winnerTeam))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   793
		SendStat(siGameResult, string.format("%s wins!", winnerTeam))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   794
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   795
		for i = 1, TeamsCount do
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   796
			SendStat(siPointType, loc("points"))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   797
			SendStat(siPlayerKills, tostring(teamStats[i].score), teamStats[i].name)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   798
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   799
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   800
		local killscomp = function (v1, v2)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   801
			if v1.kills > v2.kills then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   802
				return true
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   803
			else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   804
				return false
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   805
			end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   806
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   807
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   808
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   809
--[[ Award some awards (just for fun, its for the stats screen only
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   810
and has no effect on the score or game outcome. ]]
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   811
		local awardsGiven = 0
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   812
	
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   813
		if awardTotalKills >= 30 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   814
			awardsGiven = awardsGiven + 1
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   815
			SendStat(siCustomAchievement,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   816
				string.format(loc("%d invaders have been destroyed in this game."), awardTotalKills))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   817
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   818
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   819
		table.sort(teamStats, killscomp)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   820
		local bestKills = teamStats[1].kills
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   821
		if bestKills > 10 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   822
			awardsGiven = awardsGiven + 1
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   823
			local text
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   824
			if bestKills >= 50 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   825
				text = loc("BOOM! BOOM! BOOM! %s are the masters of destruction with %d destroyed invaders.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   826
			elseif bestKills >= 25 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   827
				text = loc("BOOM! %s really didn't like the invaders, so they decided to destroy as much as %d of them.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   828
			else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   829
				text = loc("Boom! %s has destroyed %d invaders.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   830
			end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   831
			SendStat(siCustomAchievement,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   832
			string.format(text,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   833
	                teamStats[1].name, teamStats[1].kills))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   834
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   835
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   836
		if awardRoundKills ~= nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   837
			awardsGiven = awardsGiven + 1
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   838
			local text
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   839
			if awardRoundKills.value >= 33 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   840
				text = loc("%s (%s) has been invited to join the Planetary Association of the Hedgehogs, it destroyed a staggering %d invaders in just one round!")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   841
			elseif awardRoundKills.value >= 22 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   842
				if awardRoundKills.hogName == "Rambo" then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   843
					text = loc("The hardships of the war turned %s (%s) into a killing machine: %d invaders destroyed in one round!")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   844
				else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   845
					text = loc("%s (%s) is Rambo in a hedgehog costume! He destroyed %d invaders in one round.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   846
				end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   847
			elseif awardRoundKills.value >= 11 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   848
				text = loc("%s (%s) is addicted to killing: %d invaders destoyed in one round.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   849
			else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   850
				text = loc("%s (%s) destroyed %d invaders in one round.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   851
			end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   852
			SendStat(siCustomAchievement,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   853
			string.format(text,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   854
			awardRoundKills.hogName, awardRoundKills.teamName, awardRoundKills.value))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   855
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   856
		if awardRoundScore ~= nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   857
			awardsGiven = awardsGiven + 1
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   858
			local text
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   859
			if awardRoundScore.value >= 300 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   860
				text = loc("%s (%s) was undoubtedly the very best professional tumbler in this game: %d points in one round!")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   861
			elseif awardRoundScore.value >= 250 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   862
				text = loc("%s (%s) struck like a meteor: %d points in only one round!")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   863
			elseif awardRoundScore.value >= 200 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   864
				text = loc("%s (%s) is good at this: %d points in only one round!")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   865
			elseif awardRoundScore.value >= 150 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   866
				text = loc("%s (%s) tumbles like no other: %d points in one round.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   867
			elseif awardRoundScore.value >= 100 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   868
				text = loc("%s (%s) is a tumbleweed: %d points in one round.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   869
			else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   870
				text = loc("%s (%s) was the best baby tumbler: %d points in one round.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   871
			end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   872
			SendStat(siCustomAchievement,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   873
			string.format(text,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   874
			awardRoundScore.hogName, awardRoundScore.teamName, awardRoundScore.value))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   875
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   876
		if awardAccuracy ~= nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   877
			awardsGiven = awardsGiven + 1
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   878
			local text
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   879
			if awardAccuracy.value >= 20 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   880
				text = loc("The Society of Perfectionists greets %s (%s): No misses and %d hits in its best round.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   881
			elseif awardAccuracy.value >= 10 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   882
				text = loc("%s (%s) is a hardened hunter: No misses and %d hits in its best round!")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   883
			else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   884
				text = loc("%s (%s) shot %d invaders and never missed in the best round!")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   885
			end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   886
			SendStat(siCustomAchievement,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   887
			string.format(text,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   888
			awardAccuracy.hogName, awardAccuracy.teamName, awardAccuracy.value))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   889
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   890
		if awardCombo ~= nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   891
			awardsGiven = awardsGiven + 1
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   892
			local text
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   893
			if awardCombo.value >= 11 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   894
				text = loc("%s (%s) was lightning-fast! Longest combo of %d, absolutely insane!")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   895
			elseif awardCombo.value >= 8 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   896
				text = loc("%s (%s) gave short shrift to the invaders: Longest combo of %d!")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   897
			else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   898
				text = loc("%s (%s) was on fire: Longest combo of %d.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   899
			end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   900
			SendStat(siCustomAchievement,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   901
			string.format(text,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   902
			awardCombo.hogName, awardCombo.teamName, awardCombo.value))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   903
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   904
		if awardsGiven == 0 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   905
			local text
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   906
			local r = math.random(1,4)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   907
			if r == 1 then text = loc("This game wasn’t really exciting.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   908
			elseif r == 2 then text = loc("Did I miss something?")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   909
			elseif r == 3 then text = loc("Nothing of interest has happened.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   910
			elseif r == 4 then text = loc("There are no snarky comments this time.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   911
			end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   912
		
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   913
			SendStat(siCustomAchievement, text)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   914
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   915
	end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   916
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   917
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   918
function onNewRound()
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   919
	roundNumber = roundNumber + 1
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   920
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   921
	CommentOnScore()
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   922
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   923
	-- end game if its at round limit
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   924
	if roundNumber >= roundLimit then
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   925
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   926
		for i = 0, (TeamsCount-1) do
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   927
			if teamScore[i] > bestScore then
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   928
				bestScore = teamScore[i]
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   929
				bestClan = teamClan[i]
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   930
			end
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   931
		end
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   932
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   933
		gameOver = true
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   934
		TurnTimeLeft = 0	--1
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   935
		TimeLeft = 0
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   936
		SendStat(siGraphTitle, "Score graph")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   937
		EndGame()
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   938
	end
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   939
end
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   940
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   941
-- gaudy racer
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   942
function CheckForNewRound()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   943
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   944
	----------
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   945
	-- new
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   946
	----------
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   947
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   948
	--[[if gameBegun == true then
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   949
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   950
		if RoundHasChanged == true then
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   951
			roundN = roundN + 1
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   952
			RoundHasChanged = false
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   953
			onNewRound()
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   954
		end
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   955
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   956
		if lastRound ~= TotalRounds then -- new round, but not really
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   957
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   958
			if RoundHasChanged == false then
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   959
				RoundHasChanged = true
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   960
			end
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   961
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   962
		end
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   963
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   964
		--AddCaption("RoundN:" .. roundN .. "; " .. "TR: " .. TotalRounds)
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   965
		lastRound = TotalRounds
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   966
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   967
	end]]
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   968
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   969
	----------
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   970
	-- old
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   971
	----------
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   972
	if GetHogClan(CurrentHedgehog) == firstClan then
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   973
		onNewRound()
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   974
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   975
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   976
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   977
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   978
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   979
----------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   980
-- some tumbler/space invaders methods
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
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   983
function isATrackedGear(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   984
	if 	(GetGearType(gear) == gtExplosives) or
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   985
		(GetGearType(gear) == gtShell) or
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   986
		(GetGearType(gear) == gtFlame) or-- new -- gtBall
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   987
		(GetGearType(gear) == gtBall)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   988
	then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   989
		return(true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   990
	else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   991
		return(false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   992
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   993
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   994
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   995
function setNewGearValues(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   996
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   997
	if GetGearType(gear) == gtShell then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   998
		lfs = 50	-- roughly 5 seconds
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   999
		shellID = shellID + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1000
		setGearValue(gear,"ID",shellID)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1001
		--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
  1002
	elseif GetGearType(gear) == gtBall then
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1003
		lfs = 5 --70	-- 7s
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1004
	elseif GetGearType(gear) == gtExplosives then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1005
		lfs = 15	-- 1.5s
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1006
		explosivesID = explosivesID + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1007
		setGearValue(gear,"ID",explosivesID)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1008
		setGearValue(gear,"XP", GetX(gear))
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1009
		setGearValue(gear,"YP", GetY(gear))
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1010
		--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
  1011
	elseif GetGearType(gear) == gtFlame then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1012
		lfs = 5	-- 0.5s
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1013
	else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1014
		lfs = 100
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1015
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1016
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1017
	setGearValue(gear,"lifespan",lfs)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1018
	--WriteLnToConsole("I also set its lifespan to " .. lfs)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1019
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1020
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1021
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1022
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1023
function HandleLifeSpan(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1024
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1025
	decreaseGearValue(gear,"lifespan")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1026
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1027
	--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
  1028
	--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
  1029
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1030
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1031
	if getGearValue(gear,"lifespan") == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1032
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1033
		if GetGearType(gear) == gtShell then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1034
			AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false)
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1035
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1036
			--AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1037
			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
  1038
		--elseif GetGearType(gear) == gtBall then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1039
		--	AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1040
		elseif GetGearType(gear) == gtExplosives then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1041
			AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1042
			PlaySound(sndExplosion)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1043
			--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
  1044
		elseif GetGearType(gear) == gtFlame then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1045
			AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1046
			--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
  1047
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1048
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1049
		DeleteGear(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1050
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1051
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1052
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1053
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1054
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1055
-- 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
  1056
function DeleteFarFlungBarrel(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1057
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1058
	if GetGearType(gear) == gtExplosives then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1059
		if 	(GetX(gear) < -1900) or
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1060
			(GetX(gear) > 6200) or
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1061
			(GetY(gear) < -3400)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1062
		then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1063
			AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1064
			DeleteGear(gear)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1065
			--SetHealth(gear, 0)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1066
			--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
  1067
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1068
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1069
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1070
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1071
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1072
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
--EVENT HANDLERS
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1075
-- action keys
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1076
-----------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1077
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1078
function HandleFlameThrower()
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1079
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1080
	--
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1081
	--flamer
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1082
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1083
	fireTimer = fireTimer + 1
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1084
	if fireTimer == 6 then	-- 6
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1085
		fireTimer = 0
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1086
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1087
		if (wep[wepIndex] == loc("Flamer") ) and (preciseOn == true) and (wepAmmo[wepIndex] > 0) and (stopMovement == false) and (tumbleStarted == true) then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1088
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1089
			wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1090
			AddCaption(
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1091
			loc("Flamer") .. ": " ..
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1092
			(wepAmmo[wepIndex]/800*100) - (wepAmmo[wepIndex]/800*100)%2 .. "%",
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1093
			wepCol[2],
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1094
			capgrpMessage2
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1095
			)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1096
			DrawTag(3)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1097
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1098
			dx, dy = GetGearVelocity(CurrentHedgehog)					--gtFlame -- gtSnowball -- gtAirBomb
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1099
			shell = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtFlame, 0, 0, 0, 0)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1100
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1101
			xdev = 1 + GetRandom(35)	--25
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1102
			xdev = xdev / 100
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1103
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1104
			r = GetRandom(2)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1105
			if r == 1 then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1106
				xdev = xdev*-1
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1107
			end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1108
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1109
			ydev = 1 + GetRandom(35)	--25
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1110
			ydev = ydev / 100
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1111
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1112
			r = GetRandom(2)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1113
			if r == 1 then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1114
				ydev = ydev*-1
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1115
			end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1116
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1117
								--4.5	or 2.5 nonflames				--4.5
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1118
			SetGearVelocity(shell, (dx*4.5)+(xdev*fMod), (dy*4.5)+(ydev*fMod))	--10
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1119
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1120
		end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1121
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1122
	end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1123
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1124
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1125
end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1126
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1127
function ChangeWeapon()
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1128
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1129
	wepIndex = wepIndex + 1
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1130
	if wepIndex == wepCount then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1131
		wepIndex = 0
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1132
	end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1133
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1134
--[[
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1135
	NOTE: Don’t show selected weapon as long we only have one. Remove this comment and activate this code
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1136
	again as soon as at least one other weapon appears.
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1137
	AddCaption(wep[wepIndex] .. " " .. loc("selected!"), wepCol[wepIndex],capgrpAmmoinfo )
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1138
	AddCaption(wepAmmo[wepIndex] .. " " .. loc("shots remaining."), wepCol[wepIndex],capgrpMessage2)
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1139
]]
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1140
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1141
end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1142
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1143
--function onTimer()
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1144
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1145
	-- experimental wep
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1146
	--[[SetVisualGearValues(shockwave, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 40, 255, 1, 10, 0, 300, 1, 0xff33ffff)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1147
	AddCaption("boom")
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1148
	PlaySound(sndWarp)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1149
	shockwaveHealth = 100
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1150
	shockwaveRad = 100]]
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1151
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1152
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1153
	--change wep
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1154
	--ChangeWeapon()
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1155
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1156
	-- booster
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1157
	--[[if boosterOn == false then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1158
		boosterOn = true
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1159
	else
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1160
		boosterOn = false
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1161
	end]]
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1162
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1163
--end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1164
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1165
-- o rite dis wan iz liek synched n stuff hope full lee
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1166
-- old method
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1167
--[[function onPrecise()
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1168
5245
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
	-- Fire Barrel
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1171
	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
  1172
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1173
		shotsFired = shotsFired +1
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1174
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1175
		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
  1176
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1177
		primShotsLeft = primShotsLeft - 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1178
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1179
		if primShotsLeft == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1180
			PlaySound(sndSuddenDeath)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1181
			AddCaption(loc("Ammo Depleted!"),0xff0000ff,capgrpMessage)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1182
		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
  1183
			AddCaption(loc("Ammo") .. ": " .. primShotsLeft)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1184
		end
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  1185
		DrawTag(1)
5245
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
		CopyPV(CurrentHedgehog, morte) -- new addition
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1188
		x,y = GetGearVelocity(morte)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1189
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1190
		x = x*2
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1191
		y = y*2
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1192
		SetGearVelocity(morte, x, y)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1193
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1194
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1195
	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
  1196
		AddCaption(loc("Ammo Depleted!"),0xff0000ff,capgrpMessage)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1197
	end
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
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1200
end]]
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1201
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1202
-- derp tumbler
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1203
function onPrecise()
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1204
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1205
	if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) and (wepAmmo[wepIndex] > 0) then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1206
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1207
		wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1208
		--AddCaption(wepAmmo[wepIndex] .. " " .. loc("shots remaining."), wepCol[wepIndex],capgrpMessage2)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1209
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1210
		if wep[wepIndex] == loc("Barrel Launcher") then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1211
			shotsFired = shotsFired +1
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1212
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1213
			morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtExplosives, 0, 0, 0, 1)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1214
			CopyPV(CurrentHedgehog, morte) -- new addition
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1215
			x,y = GetGearVelocity(morte)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1216
			x = x*2
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1217
			y = y*2
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1218
			SetGearVelocity(morte, x, y)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1219
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1220
			if wepAmmo[wepIndex] == 0 then
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1221
				PlaySound(sndSuddenDeath)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1222
				AddCaption(loc("Ammo Depleted!"),0xff0000ff,capgrpMessage)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1223
			else
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1224
				--AddCaption(loc("Ammo") .. ": " .. wepAmmo[wepIndex])
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1225
				PlaySound(sndThrowRelease)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1226
			end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1227
			DrawTag(1)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1228
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1229
		elseif wep[wepIndex] == loc("Mine Deployer") then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1230
			morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtAirBomb, 0, 0, 0, 0)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1231
			SetTimer(morte, 1000)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1232
			DrawTag(1)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1233
		end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1234
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1235
	elseif (wepAmmo[wepIndex] == 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1236
		PlaySound(sndDenied)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1237
		AddCaption(loc("Ammo Depleted!"),0xff0000ff,capgrpMessage)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1238
	end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1239
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1240
	preciseOn = true
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1241
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1242
end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1243
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1244
function onPreciseUp()
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1245
	preciseOn = false
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1246
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1247
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1248
function onLJump()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1249
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1250
	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
  1251
		shieldMiser = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1252
		if shieldHealth == 80 then
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1253
			AddCaption(loc("Shield Depleted"),0xff0000ff,capgrpMessage)
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1254
			PlaySound(sndDenied)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1255
		elseif (beam == false) and (shieldHealth > 80) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1256
			beam = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1257
			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
  1258
			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
  1259
			PlaySound(sndWarp)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1260
		else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1261
			beam = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1262
			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
  1263
			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
  1264
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1265
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1266
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1267
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1268
function onHJump()
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1269
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1270
	if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) and
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1271
	(rAlpha == 255) then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1272
		if radShotsLeft > 0 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1273
			rPingTimer = 0
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1274
			rAlpha = 0
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1275
			radShotsLeft = radShotsLeft -1
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1276
			AddCaption(loc("Pings left:") .. " " .. radShotsLeft,GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1277
			-- Play sonar sound
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1278
			PlaySound(sndJetpackLaunch)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1279
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1280
		else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1281
			AddCaption(loc("No radar pings left!"),0xFF0000FF,capgrpMessage)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1282
			PlaySound(sndDenied)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1283
		end
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1284
	end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1285
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1286
end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1287
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1288
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1289
-- movement keys
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
function onLeft()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1293
	leftOn = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1294
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1295
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1296
function onRight()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1297
	rightOn = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1298
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1299
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1300
function onUp()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1301
	upOn = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1302
end
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
function onDown()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1305
	downOn = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1306
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1307
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1308
function onDownUp()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1309
	downOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1310
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1311
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1312
function onUpUp()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1313
	upOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1314
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1315
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1316
function onLeftUp()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1317
	leftOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1318
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1319
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1320
function onRightUp()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1321
	rightOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1322
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1323
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1324
--------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1325
-- other event handlers
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1326
--------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1327
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1328
function onParameters()
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1329
	parseParams()
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1330
	if params["rounds"] ~= nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1331
		roundLimit = math.floor(tonumber(params["rounds"]))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1332
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1333
	if params["barrels"] ~= nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1334
		startBarrels = math.floor(tonumber(params["barrels"]))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1335
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1336
	if params["pings"] ~= nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1337
		startRadShots = math.floor(tonumber(params["pings"]))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1338
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1339
	if params["shield"] ~= nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1340
		startShield = math.floor(tonumber(params["shield"]))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1341
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1342
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1343
	if params["barrelbonus"] ~= nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1344
		barrelBonus = math.floor(tonumber(params["barrelbonus"]))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1345
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1346
	if params["shieldbonus"] ~= nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1347
		shieldBonus = math.floor(tonumber(params["shieldbonus"]))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1348
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1349
	if params["timebonus"] ~= nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1350
		timeBonus = math.floor(tonumber(params["timebonus"]))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1351
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1352
	if params["forcetheme"] == "false" then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1353
		forceTheme = false
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1354
	else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1355
		forceTheme = true
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1356
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1357
end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1358
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1359
function onGameInit()
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1360
	--[[ Only GameFlags which are listed here are allowed. All other game flags will be discarded.
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1361
	Nonetheless this allows for some configuration in the game scheme ]]
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1362
	local allowedFlags = 
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1363
		-- those flags are probably the most realistic one to use
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1364
		gfDisableGirders + gfRandomOrder +	-- highly recommended!
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1365
		gfDisableLandObjects + gfSolidLand + gfLowGravity +
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1366
		-- a bit unusual but may still be useful
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1367
		gfBottomBorder + gfForts + gfDivideTeams +
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1368
		gfDisableWind + gfMoreWind + gfTagTeam +
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1369
		-- very unusual flags, they don’t affect gameplay really, they are mostly for funny graphical effects
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1370
		gfKing + 	-- King Mode doesn’t work like expected, since hedgehogs never really die here in this mode
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1371
		gfVampiric +	-- just for the grapical effects
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1372
		gfBorder 	-- technically possible, but not very fun to play
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1373
		-- any other flag is FORBIDDEN and will be disabled when it is on anyways!
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1374
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1375
	GameFlags = band(GameFlags, allowedFlags)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1376
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1377
	if forceTheme then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1378
		Theme = "EarthRise"
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1379
	end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1380
	CaseFreq = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1381
	HealthCaseProb = 0
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1382
	Delay = 1000
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1383
	SuddenDeathTurns = 50
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1384
	WaterRise = 0
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1385
	HealthDecrease = 0
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1386
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1387
	for i = 0, 4 do
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1388
		vTag[0] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  1389
	end
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  1390
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  1391
	HideTags()
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  1392
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1393
	wep[0] = loc("Barrel Launcher")
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1394
	wep[1] = loc("Mine Deployer")
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1395
	wep[2] = loc("Flamer")
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1396
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1397
	wepCol[0] = 0x78818eff
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1398
	wepCol[1] = 0xa12a77ff
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1399
	wepCol[2] = 0xf49318ff
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1400
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1401
	wepCount = 3
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1402
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1403
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1404
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1405
function onGameStart()
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1406
	SendHealthStatsOff()
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1407
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1408
	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
  1409
				"SPACE INVASION",
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1410
				loc("a Hedgewars mini-game"),
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1411
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1412
				loc("Destroy invaders to score points.") .. "|" ..
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1413
				" " .. "|" ..
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1414
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
  1415
				loc("Round Limit") .. ": " .. roundLimit .. "|" ..
5332
b29d60c7cac7 Use an ifdef instead, add despeckling of tunnels
nemo
parents: 5325
diff changeset
  1416
				loc("Turn Time") .. ": " .. (TurnTime/1000) .. loc("sec") .. "|" ..
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1417
				" " .. "|" ..
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
				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
  1420
				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
  1421
				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
  1422
				loc("Radar Ping") .. ": " .. loc("[Backspace]") .. "|" ..
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1423
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1424
				--" " .. "|" ..
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
  1425
				--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
  1426
				--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
  1427
				--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
  1428
				--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
  1429
				--LOC_NOT("Green Wrangler: (3 points)") .. "|" ..
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1430
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
				"", 4, 4000
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1433
				)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1434
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1435
	CreateMeSomeCircles()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1436
	RebuildTeamInfo() -- control
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1437
	lastRound = TotalRounds
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1438
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1439
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1440
5825
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
  1441
function onScreenResize()
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
  1442
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
  1443
	-- 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
  1444
	if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
  1445
			DrawTag(0)
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
  1446
			DrawTag(1)
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
  1447
			DrawTag(2)
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1448
			DrawTag(4)
5825
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
  1449
	end
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
  1450
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
  1451
end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1452
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1453
function onNewTurn()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1454
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1455
	--primShotsLeft = primShotsMax
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1456
	radShotsLeft = startRadShots
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1457
	stopMovement = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1458
	tumbleStarted = false
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1459
	boosterOn = false
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1460
	beam = false
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1461
	shieldHealth = startShield + 80 -- 50 = 5 secs, roughly
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1462
	shockwaveHealth = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1463
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1464
	RK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1465
	GK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1466
	BK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1467
	OK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1468
	SK = 0
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1469
	roundKills = 0
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1470
	roundScore = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1471
	shieldMiser = true
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1472
	fierceComp = false
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1473
	shotsFired = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1474
	shotsHit = 0
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1475
	sniperHits = 0
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1476
	pointBlankHits = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1477
	chainLength = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1478
	chainCounter = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1479
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1480
	-------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1481
	-- gaudy racer
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1482
	-------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1483
	CheckForNewRound()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1484
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1485
	-- Handle Starting Stage of Game
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1486
	if (gameOver == false) and (gameBegun == false) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1487
		gameBegun = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1488
		roundNumber = 0 -- 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1489
		firstClan = GetHogClan(CurrentHedgehog)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1490
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1491
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1492
	if gameOver == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1493
		gameBegun = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1494
		stopMovement = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1495
		tumbleStarted = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1496
		SetMyCircles(false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1497
	end
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1498
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1499
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1500
	-------
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1501
	-- tumbler
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1502
	----
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1503
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1504
	wepAmmo[0] = startBarrels
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1505
	wepAmmo[1] = startRadShots
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1506
	wepAmmo[2] = 5000
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1507
	wepIndex = 2
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1508
	ChangeWeapon()
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1509
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1510
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  1511
	HideTags()
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  1512
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1513
	---------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1514
	---------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1515
	--AddCaption("num g: " .. numGears() )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1516
	--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
  1517
	--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
  1518
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1519
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1520
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1521
function ThingsToBeRunOnGears(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1522
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1523
	HandleLifeSpan(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1524
	DeleteFarFlungBarrel(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1525
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1526
	if CirclesAreGo == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1527
		CheckVarious(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1528
		ProjectileTrack(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1529
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1530
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1531
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1532
10670
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1533
function onGearWaterSkip(gear)
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1534
	if gear == CurrentHedgehog then
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1535
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1536
		for i = 0,(TeamsCount-1) do
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1537
			if teamClan[i] == GetHogClan(CurrentHedgehog) and (teamSurfer[i] == false) then
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1538
				teamSurfer[i] = true
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1539
				AddCaption(loc("Surfer! +15 points!"),0xffba00ff,capgrpVolume)
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1540
				AwardPoints(15)
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1541
			end
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1542
		end
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1543
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1544
	end
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1545
end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1546
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  1547
function onGameTick()
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1548
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1549
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1550
	--WriteLnToConsole("Start of GameTick")
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  1551
	luaGameTicks = luaGameTicks + 1 -- GameTime
5245
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
	HandleCircles()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1554
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1555
	-- derp
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1556
	--if shockwaveHealth > 0 then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1557
	--	shockwaveHealth = shockwaveHealth - 1
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1558
	--	shockwaveRad = shockwaveRad + 5
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1559
	--end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1560
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1561
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  1562
	Timer100 = Timer100 + 1
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  1563
	if Timer100 >= 100 then
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  1564
		Timer100 = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1565
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1566
		if beam == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1567
			shieldHealth = shieldHealth - 1
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  1568
			if shieldHealth < 80 then -- <= 80
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1569
				shieldHealth = 80
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1570
				beam = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1571
				AddCaption(loc("Shield Depleted"),0xff0000ff,capgrpMessage)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1572
				PlaySound(sndMineTick)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1573
				PlaySound(sndSwitchHog)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1574
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1575
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1576
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1577
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1578
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1579
		--nw WriteLnToConsole("Starting ThingsToBeRunOnGears()")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1580
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1581
		runOnGears(ThingsToBeRunOnGears)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1582
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1583
		--nw WriteLnToConsole("Finished ThingsToBeRunOnGears()")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1584
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1585
		--runOnGears(HandleLifeSpan)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1586
		--runOnGears(DeleteFarFlungBarrel)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1587
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  1588
		if CirclesAreGo == true then
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1589
			CheckDistances()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1590
			--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
  1591
			--runOnGears(ProjectileTrack)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1592
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1593
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1594
		-- 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
  1595
		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
  1596
			j,k = GetGearVelocity(CurrentHedgehog)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1597
			if (j ~= 0) and (k ~= 0) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1598
				AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmoke, 0, true)
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
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1601
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1602
		--nw WriteLnToConsole("Finished 100Timer")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1603
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1604
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1605
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1606
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1607
	-- 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
  1608
	if (tumbleStarted == false) and (gameOver == false) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1609
		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
  1610
			--AddCaption(LOC_NOT("Good to go!"))
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1611
			tumbleStarted = true
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  1612
			TimeLeft = (TurnTime/1000)	--45
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1613
			FadeAlpha = 0
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1614
			rAlpha = 255
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1615
			AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  1616
			DrawTag(0)
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  1617
			DrawTag(1)
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  1618
			DrawTag(2)
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1619
			DrawTag(4)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1620
			SetMyCircles(true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1621
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1622
	end
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
	--WriteLnToConsole("Finished initial check")
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
	if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1627
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1628
		--AddCaption(GetX(CurrentHedgehog) .. ";" .. GetY(CurrentHedgehog) )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1629
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1630
		-- Calculate and display turn time
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  1631
		TimeLeftCounter = TimeLeftCounter + 1
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  1632
		if TimeLeftCounter == 1000 then
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  1633
			TimeLeftCounter = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1634
			TimeLeft = TimeLeft - 1
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
			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
  1637
				--AddCaption(LOC_NOT("Time Left: ") .. TimeLeft)
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  1638
				DrawTag(0)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1639
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1640
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1641
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1642
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1643
		if (TimeLeftCounter % 1000) == 0 and TimeLeft == 5 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1644
			PlaySound(sndHurry, CurrentHedgehog)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1645
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1646
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1647
		--WriteLnToConsole("Finished timeleft calculations")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1648
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
		-- 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
  1651
		-------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1652
		-- checks in FloatyThings
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1653
		if PlayerIsFine() == false then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1654
			TimeLeft = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1655
		end
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1656
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1657
		--WriteLnToConsole("successfully checked playerIsFine")
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1658
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1659
		if (TimeLeft == 0) then
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1660
			if PlayerIsFine() then AddCaption(loc("Time's up!")) end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1661
			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
  1662
				stopMovement = true
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1663
				boosterOn = false
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1664
				beam = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1665
				upOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1666
				down = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1667
				leftOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1668
				rightOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1669
				SetMyCircles(false)
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1670
				rAlpha = 255
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1671
				--nw WriteLnToConsole("Player is out of luck")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1672
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1673
				if shieldMiser == true then
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1674
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1675
					p = (roundKills*3.5) - ((roundKills*3.5)%1) + 2
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1676
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1677
					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
  1678
					AwardPoints(p)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1679
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1680
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1681
				local accuracy = (shotsHit / shotsFired) * 100
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1682
				if (accuracy >= 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
  1683
					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
  1684
					AwardPoints(15)
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1685
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1686
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1687
					-- special award for no misses
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1688
					local award = false
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1689
					if awardAccuracy == nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1690
						if (shotsHit >= shotsFired) then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1691
							award = true
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1692
						end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1693
					elseif (shotsHit == shotsFired) and shotsHit > awardAccuracy.value then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1694
						award = true
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1695
					end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1696
					if award then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1697
						awardAccuracy = {
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1698
							hogName = GetHogName(CurrentHedgehog),
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1699
							teamName = GetHogTeamName(CurrentHedgehog),
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1700
							value = shotsHit, 
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1701
						}
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1702
					end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1703
		
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1704
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1705
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1706
				AddCaption(loc(string.format("Round score: %d", roundScore)), 0xFFFFFFFF, capgrpMessage2)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1707
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1708
				-- other awards
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1709
				awardRoundScore = UpdateSimpleAward(awardRoundScore, roundScore, 50)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1710
				awardRoundKills = UpdateSimpleAward(awardRoundKills, roundKills, 5)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1711
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1712
				HideTags()
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1713
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1714
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1715
		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
  1716
		-------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1717
		-- Player is still in luck
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1718
		-------------------------------
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1719
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1720
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1721
			--WriteLnToConsole("about to do chainCounter checks")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1722
			if chainCounter > 0 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1723
				chainCounter = chainCounter -1
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1724
				if chainCounter == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1725
					chainLength = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1726
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1727
			end
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1728
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1729
			-- handle movement based on IO
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  1730
			moveTimer = moveTimer + 1
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  1731
			if moveTimer == 100 then -- 100
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1732
				--nw WriteLnToConsole("Start of Player MoveTimer")
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  1733
				moveTimer = 0
5245
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
				---------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1736
				-- new trail code
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1737
				---------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1738
				-- 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
  1739
				if (TimeLeft <= 5) and (TimeLeft > 0) then							--vgtSmoke
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1740
					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
  1741
					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
  1742
					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
  1743
				end
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
				--------------
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
				dx, dy = GetGearVelocity(CurrentHedgehog)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1748
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1749
				--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
  1750
				--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
  1751
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1752
				if boosterOn == true then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1753
					tempE = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtDust, 0, false)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1754
					g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1755
					SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, 1, g9, GetClanColor(GetHogClan(CurrentHedgehog)) )
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1756
					dxlimit = 0.8*fMod
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1757
					dylimit = 0.8*fMod
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1758
				else
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1759
					dxlimit = 0.4*fMod
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1760
					dylimit = 0.4*fMod
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1761
				end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1762
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1763
				if dx > dxlimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1764
					dx = dxlimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1765
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1766
				if dy > dylimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1767
					dy = dylimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1768
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1769
				if dx < -dxlimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1770
					dx = -dxlimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1771
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1772
				if dy < -dylimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1773
					dy = -dylimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1774
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1775
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
				if leftOn == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1778
					dx = dx - 0.1*fMod
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1779
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1780
				if rightOn == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1781
					dx = dx + 0.1*fMod
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1782
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1783
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1784
				if upOn == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1785
					dy = dy - 0.1*fMod
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1786
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1787
				if downOn == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1788
					dy = dy + 0.1*fMod
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1789
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1790
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1791
				SetGearVelocity(CurrentHedgehog, dx, dy)
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
				--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
  1794
				--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
  1795
				--nw WriteLnToConsole("End of Player MoveTimer")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1796
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1797
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1798
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1799
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1800
			HandleFlameThrower()
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1801
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1802
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1803
		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
  1804
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1805
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1806
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1807
	--WriteLnToConsole("End of GameTick")
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1808
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1809
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1810
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1811
function onGearDamage(gear, damage)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1812
	if GetGearType(gear) == gtHedgehog then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1813
		if (fierceComp == false) and (damage >= 60) and (GetHogClan(gear) ~= GetHogClan(CurrentHedgehog)) then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1814
			fierceComp = true
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1815
			AddCaption(loc("Fierce Competition!") .. " +8 " .. loc("points") .. "!",0xffba00ff,capgrpGameState)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1816
			AwardPoints(8)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1817
		end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1818
	end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1819
end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1820
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1821
function onGearResurrect(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1822
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1823
	-- 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
  1824
	if gear == CurrentHedgehog then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1825
		TimeLeft = 0
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1826
		playerIsFine = false
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1827
		--WriteLnToConsole("Current hedgehog just drowned himself")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1828
		--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
  1829
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1830
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1831
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1832
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1833
function onGearAdd(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1834
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1835
	if isATrackedGear(gear) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1836
		trackGear(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1837
		setNewGearValues(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1838
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1839
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1840
	--if GetGearType(gear) == gtBall then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1841
	--	SetTimer(gear, 5000)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1842
	--end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1843
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1844
	if GetGearType(gear) == gtHedgehog then
7838
5c2337f8dbb2 Issue #443 - change in syntax for effects
nemo
parents: 7717
diff changeset
  1845
		SetEffect(gear, heResurrectable, 1)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1846
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1847
		-----------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1848
		-- control
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1849
		hhs[numhhs] = gear
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1850
		numhhs = numhhs + 1
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
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1853
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1854
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1855
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1856
function onGearDelete(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1857
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1858
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1859
	--[[if GetGearType(gear) == gtShell then
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1860
		--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
  1861
		--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
  1862
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1863
		--if CurrentHedgehog ~= nil then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1864
		--	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
  1865
		--end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1866
	elseif GetGearType(gear) == gtExplosives then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1867
		--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
  1868
		--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
  1869
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1870
		--if CurrentHedgehog ~= nil then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1871
		--	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
  1872
		--end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1873
	elseif GetGearType(gear) == gtFlame then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1874
		--WriteLnToConsole("on GearDelete flame")
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1875
	end]]
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1876
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1877
	if isATrackedGear(gear) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1878
		trackDeletion(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1879
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1880
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1881
	if CurrentHedgehog ~= nil then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1882
		FollowGear(CurrentHedgehog)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1883
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1884
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1885
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1886
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1887
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1888
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1889
------------------------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1890
------------------------------------------------------------
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
------------------------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1893
-- FLOATY THINGS
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1894
-- "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
  1895
-- 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
  1896
------------------------------------------------------------
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
------------------------------------------------------------
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
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1901
function DoHorribleThings(cUID)
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1902
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1903
	-- work out the distance to the target
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1904
	g1X, g1Y = GetGearPosition(CurrentHedgehog)
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1905
	g2X, g2Y = vCircX[cUID], vCircY[cUID]
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1906
	q = g1X - g2X
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1907
	w = g1Y - g2Y
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1908
	r = math.sqrt( (q*q) + (w*w) )	--alternate
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1909
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1910
	opp = w
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1911
	if opp < 0 then
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1912
		opp = opp*-1
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1913
	end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1914
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1915
	-- 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
  1916
	t = math.deg ( math.asin(opp / r) )
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1917
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1918
	-- based on the radius of the radar, calculate what x/y displacement should be
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1919
	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
  1920
	NX = math.cos( math.rad(t) ) * NR
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1921
	NY = math.sin( math.rad(t) ) * NR
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1922
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1923
	-- displace xy based on where this thing actually is
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1924
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1925
	if r < NR then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1926
		rCircX[cUID] = g2X
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1927
	elseif q > 0 then
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1928
		rCircX[cUID] = g1X - NX
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1929
	else
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1930
		rCircX[cUID] = g1X + NX
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1931
	end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1932
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1933
	if r < NR then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1934
		rCircY[cUID] = g2Y
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1935
	elseif w > 0 then
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1936
		rCircY[cUID] = g1Y - NY
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1937
	else
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1938
		rCircY[cUID] = g1Y + NY
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1939
	end
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1940
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1941
end
5245
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
function PlayerIsFine()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1944
	return (playerIsFine)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1945
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1946
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1947
function GetDistFromXYtoXY(a, b, c, d)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1948
	q = a - c
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1949
	w = b - d
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1950
	return ( (q*q) + (w*w) )
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1951
end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1952
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1953
function GetDistFromGearToGear(gear, gear2)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1954
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1955
	g1X, g1Y = GetGearPosition(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1956
	g2X, g2Y = GetGearPosition(gear2)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1957
	q = g1X - g2X
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1958
	w = g1Y - g2Y
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1959
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1960
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1961
	--[[
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1962
	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
  1963
	if gear == CurrentHedgehog then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1964
		WriteLnToConsole("Gear 1 is CurrentHedgehog.")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1965
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1966
	if gear2 == CurrentHedgehog then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1967
		WriteLnToConsole("Gear 2 is CurrentHedgehog.")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1968
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1969
	WriteLnToConsole("G1X: " .. g1X .. "; G1Y: " .. g1Y)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1970
	WriteLnToConsole("G2X: " .. g2X .. "; G2Y: " .. g2Y)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1971
	WriteLnToConsole("Their distance is " .. (q*q) + (w*w) )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1972
	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
  1973
]]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1974
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1975
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1976
	return ( (q*q) + (w*w) )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1977
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1978
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1979
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1980
function GetDistFromGearToXY(gear, g2X, g2Y)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1981
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1982
	g1X, g1Y = GetGearPosition(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1983
	q = g1X - g2X
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1984
	w = g1Y - g2Y
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1985
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1986
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1987
	--[[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
  1988
	if gear == CurrentHedgehog then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1989
		WriteLnToConsole("Gear 1 is CurrentHedgehog.")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1990
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1991
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1992
	WriteLnToConsole("G1X: " .. g1X .. "; G1Y: " .. g1Y)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1993
	WriteLnToConsole("Other X: " .. g2X .. "; Other Y: " .. g2Y)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1994
	WriteLnToConsole("Their distance is " .. (q*q) + (w*w) )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1995
	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
  1996
]]
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
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1999
	return ( (q*q) + (w*w) )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2000
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2001
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2002
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2003
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2004
function CreateMeSomeCircles()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2005
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2006
	for i = 0, 7 do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2007
		vCCount = vCCount +1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2008
		vCirc[i] = AddVisualGear(0,0,vgtCircle,0,true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2009
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2010
		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
  2011
		rCircX[i] = 0
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2012
		rCircY[i] = 0
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2013
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2014
		vCircDX[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2015
		vCircDY[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2016
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2017
		vType[i] = "generic"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2018
		vCounter[i] = 0
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2019
		vCounterLim[i] = 3000
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2020
		vCircScore[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2021
		vCircHealth[i] = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2022
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2023
		vCircMinA[i] = 80	--80 --20
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2024
		vCircMaxA[i] = 255
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2025
		vCircType[i] = 1	--1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2026
		vCircPulse[i] = 10
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2027
		vCircFuckAll[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2028
		vCircRadius[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2029
		vCircWidth[i] = 3 --5
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2030
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2031
		vCircRadMax[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2032
		vCircRadMin[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2033
		vCircRadDir[i] = -1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2034
		vCircRadCounter[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2035
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2036
		vCircX[i], vCircY[i] = 0,0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2037
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2038
		vCircCol[i] = 0xff00ffff
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2039
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2040
		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
  2041
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2042
		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
  2043
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2044
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2045
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2046
	pShield = AddVisualGear(0,0,vgtCircle,0,true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2047
	--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
  2048
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2049
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2050
	shockwave = AddVisualGear(0,0,vgtCircle,0,true)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2051
5245
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
function IGotMeASafeXYValue(i)
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
	acceptibleDistance = 800
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2057
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2058
	-- 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
  2059
	--vCircX[i] = GetX(CurrentHedgehog)+250
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2060
	--vCircY[i] = GetY(CurrentHedgehog)+250
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2061
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2062
	vCircX[i] = GetRandom(5000)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2063
	vCircY[i] = GetRandom(2000)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2064
	dist = GetDistFromGearToXY(CurrentHedgehog, vCircX[i], vCircY[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2065
	if dist > acceptibleDistance*acceptibleDistance then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2066
		return(true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2067
	else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2068
		return(false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2069
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2070
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2071
end
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
function CircleDamaged(i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2074
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2075
	res = ""
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2076
	vCircHealth[i] = vCircHealth[i] -1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2077
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2078
	if vCircHealth[i] <= 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2079
	-- circle is dead, do death effects/consequences
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
		vCircActive[i] = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2082
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2083
		if (vType[i] == "drone") then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2084
			PlaySound(sndHellishImpact4)
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2085
			TimeLeft = TimeLeft + timeBonus
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2086
			AddCaption(loc("Time Extended!") .. "+" .. timeBonus .. loc("sec"), 0xff0000ff,capgrpMessage )
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  2087
			DrawTag(0)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2088
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2089
			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
  2090
			SetHealth(morte, 0)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2091
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2092
			RK = RK + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2093
			if RK == 5 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2094
				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
  2095
				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
  2096
				AwardPoints(10)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2097
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2098
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2099
		elseif (vType[i] == "ammo") then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2100
			AddVisualGear(vCircX[i], vCircY[i], vgtExplosion, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2101
			PlaySound(sndExplosion)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2102
			PlaySound(sndShotgunReload)
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2103
			wepAmmo[0] = wepAmmo[0] + barrelBonus
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2104
			--primShotsLeft = primShotsLeft + 3
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2105
			AddCaption(string.format("+%d Ammo", barrelBonus), 0x00ff00ff,capgrpMessage)
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  2106
			DrawTag(1)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2107
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2108
			GK = GK + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2109
			if GK == 3 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2110
				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
  2111
				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
  2112
				AwardPoints(5)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2113
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2114
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2115
		elseif (vType[i] == "bonus") then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2116
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2117
			AddVisualGear(vCircX[i], vCircY[i], vgtExplosion, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2118
			PlaySound(sndExplosion)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2119
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2120
			AddVisualGear(vCircX[i], vCircY[i], vgtFire, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2121
			AddVisualGear(vCircX[i], vCircY[i], vgtFire, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2122
			AddVisualGear(vCircX[i], vCircY[i], vgtFire, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2123
			AddVisualGear(vCircX[i], vCircY[i], vgtFire, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2124
			AddVisualGear(vCircX[i], vCircY[i], vgtFire, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2125
			AddVisualGear(vCircX[i], vCircY[i], vgtSmoke, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2126
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2127
			PlaySound(sndVaporize)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2128
			--sndWarp sndMineTick --sndSwitchHog --sndSuddenDeath
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2129
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2130
			shieldHealth = shieldHealth + shieldBonus
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2131
			AddCaption(string.format(loc("Shield boosted! +%d power"),shieldBonus), 0xa800ffff,capgrpMessage)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2132
			if shieldHealth >= 250 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2133
				shieldHealth = 250
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2134
				AddCaption(loc("Shield is fully recharged!"),0xa800ffff,capgrpMessage)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2135
			end
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  2136
			DrawTag(2)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2137
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2138
			OK = OK + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2139
			if OK == 3 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2140
				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
  2141
				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
  2142
				AwardPoints(10)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2143
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2144
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2145
		elseif (vType[i] == "blueboss") then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2146
			PlaySound(sndHellishImpact3)
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2147
			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
  2148
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2149
			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
  2150
			SetHealth(morte, 0)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2151
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2152
			BK = BK + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2153
			if BK == 2 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2154
				BK = 0
5334
ce404661aac6 Fix some quirky syntax.
mikade
parents: 5332
diff changeset
  2155
				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
  2156
				AwardPoints(25)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2157
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2158
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2159
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2160
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2161
		AwardPoints(vCircScore[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2162
		AwardKills()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2163
		SetUpCircle(i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2164
		res = "fatal"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2165
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2166
		chainCounter = 3000
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2167
		chainLength = chainLength + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2168
		if chainLength > 1 then
5334
ce404661aac6 Fix some quirky syntax.
mikade
parents: 5332
diff changeset
  2169
			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
  2170
			AwardPoints(chainLength*2)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2171
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2172
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2173
		awardCombo = UpdateSimpleAward(awardCombo, chainLength, 5)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2174
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2175
	else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2176
	-- circle is merely damaged
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2177
	-- do damage effects/sounds
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2178
		AddVisualGear(vCircX[i], vCircY[i], vgtSteam, 0, false)
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2179
		r = math.random(1,4)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2180
		PlaySound(_G["sndHellishImpact" .. tostring(r)])
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2181
		res = "non-fatal"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2182
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2183
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2184
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2185
	return(res)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2186
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2187
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2188
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2189
function SetUpCircle(i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2190
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2191
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2192
	r = GetRandom(10)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2193
	--r = 8
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2194
	-- 80% of spawning either red/green
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2195
	if r <= 7 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2196
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2197
		--r = GetRandom(5)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2198
		r = GetRandom(2)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2199
		--r = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2200
		if r == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2201
		--if r <= 2 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2202
			vCircCol[i] = 0xff0000ff -- red
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2203
			vType[i] = "drone"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2204
			vCircRadMin[i] = 50	*5
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2205
			vCircRadMax[i] = 90	*5
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2206
			vCounterLim[i] = 3000
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2207
			vCircScore[i] = 10
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2208
			vCircHealth[i] = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2209
		--else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2210
		elseif r == 1 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2211
			vCircCol[i] = 0x00ff00ff -- green
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2212
			vType[i] = "ammo"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2213
			vCircRadMin[i] = 25	*7
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2214
			vCircRadMax[i] = 30	*7
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2215
			vCircScore[i] = 3
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2216
			vCircHealth[i] = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2217
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2218
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2219
	-- 20% chance of spawning boss or bonus
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2220
	else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2221
		r = GetRandom(5)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2222
		--r = GetRandom(2)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2223
		--r = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2224
		if r <= 1 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2225
		--if r == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2226
			vCircCol[i] = 0x0050ffff -- sexy blue
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2227
			vType[i] = "blueboss"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2228
			vCircRadMin[i] = 100*5
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2229
			vCircRadMax[i] = 180*5
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2230
			vCircWidth[i] = 1
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2231
			vCounterLim[i] = 2000
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2232
			vCircScore[i] = 30
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2233
			vCircHealth[i] = 3
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2234
		else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2235
		--elseif r == 1 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2236
			--vCircCol[i] = 0xffae00ff -- orange
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2237
			vCircCol[i] = 0xa800ffff -- purp
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2238
			vType[i] = "bonus"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2239
			vCircRadMin[i] = 20 *7
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2240
			vCircRadMax[i] = 40 *7
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2241
			vCircScore[i] = 5
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2242
			vCircHealth[i] = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2243
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2244
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2245
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2246
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2247
	-- 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
  2248
	reN = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2249
	--zzz = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2250
	while (reN < 10) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2251
		if IGotMeASafeXYValue(i) == false then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2252
			reN = reN + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2253
			--zzz = zzz + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2254
		else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2255
			reN = 15
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2256
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2257
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2258
	--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
  2259
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2260
	vCircRadius[i] = vCircRadMax[i] - GetRandom(vCircRadMin[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2261
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2262
	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
  2263
	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
  2264
	-- - -0x000000ff
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2265
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2266
	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
  2267
	SetVisualGearValues(rCirc[i], 0, 0, g3, g4, g5, g6, g7, g8, g9, vCircCol[i]-0x000000ff)
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  2268
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2269
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2270
	vCircActive[i] = true -- new
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2271
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2272
	--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
  2273
	--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
  2274
	--nw WriteLnToConsole("CIRC " .. i .. ": RAD:" .. vCircRadius[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2275
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2276
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2277
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2278
function SetMyCircles(s)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2279
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2280
	CirclesAreGo = s
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2281
	playerIsFine = s
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2282
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2283
	if s == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2284
		--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
  2285
		for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2286
			--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
  2287
			--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
  2288
			--nw WriteLnToConsole("CIRC " .. i .. ": RAD:" .. vCircRadius[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2289
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2290
		--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
  2291
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2292
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2293
	for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2294
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2295
		if s == false then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2296
			--vCircCol[i] = 0xffffffff
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2297
			vCircActive[i] = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2298
		elseif s == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2299
			SetUpCircle(i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2300
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2301
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2302
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2303
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2304
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2305
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2306
function WellHeAintGonnaJumpNoMore(x,y,explode)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2307
	if explode==true then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2308
		AddVisualGear(x, y, vgtBigExplosion, 0, false)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2309
		PlaySound(sndExplosion)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2310
		local r = math.random(1,3)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2311
		PlaySound(_G["sndOoff"..r], CurrentHedgehog)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2312
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2313
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2314
	playerIsFine = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2315
	AddCaption(loc("GOTCHA!"))
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2316
	PlaySound(sndHellish)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2317
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2318
	targetHit = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2319
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2320
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2321
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2322
--- collision detection for weapons fire
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2323
function CheckVarious(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2324
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2325
	--if (GetGearType(gear) == gtExplosives) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2326
		--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
  2327
	--elseif (GetGearType(gear) == gtShell) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2328
		--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
  2329
	--end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2330
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2331
	targetHit = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2332
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2333
	-- if circle is hit by player fire
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2334
	if (GetGearType(gear) == gtExplosives) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2335
		circsHit = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2336
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2337
		for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2338
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2339
			--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
  2340
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2341
			--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
  2342
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2343
				--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
  2344
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2345
				dist = GetDistFromGearToXY(gear, vCircX[i], vCircY[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2346
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2347
				-- 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
  2348
				if vCircType[i] == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2349
					NR = vCircRadius[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2350
				else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2351
					NR = (48/100*vCircRadius[i])/2
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2352
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2353
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2354
				if dist <= NR*NR then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2355
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2356
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2357
					--nw WriteLnToConsole("Collision confirmed. The gtExplosives is within the circ radius!")
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2358
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2359
					dist = (GetDistFromXYtoXY(vCircX[i], vCircY[i], getGearValue(gear,"XP"), getGearValue(gear,"YP")) - (NR*NR))
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2360
					--AddCaption(loc("Dist: ") .. dist .. "!",0xffba00ff,capgrpGameState)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2361
					if dist >= 1000000 then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2362
						sniperHits = sniperHits +1
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2363
						AddCaption(loc("Sniper!") .. " +8 " .. loc("points") .. "!",0xffba00ff,capgrpGameState)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2364
						AwardPoints(8)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2365
						if sniperHits == 3 then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2366
							sniperHits = 0
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2367
							AddCaption(loc("They Call Me Bullseye!") .. " +16 " .. loc("points") .. "!",0xffba00ff,capgrpGameState)
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2368
							AwardPoints(16)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2369
						end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2370
					elseif dist <= 6000 then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2371
						pointBlankHits = pointBlankHits +1
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2372
						if pointBlankHits == 3 then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2373
							pointBlankHits = 0
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2374
							AddCaption(loc("Point Blank Combo!") .. " +5 " .. loc("points") .. "!",0xffba00ff,capgrpGameState)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2375
							AwardPoints(5)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2376
						end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2377
					end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2378
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2379
					AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2380
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2381
					targetHit = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2382
					--DeleteGear(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2383
					--SetHealth(gear,0)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2384
						--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
  2385
						--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
  2386
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2387
					CircleDamaged(i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2388
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2389
					circsHit = circsHit + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2390
					if circsHit > 1 then
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2391
						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
  2392
						AwardPoints(15)
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2393
						circsHit = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2394
					end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2395
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2396
					shotsHit = shotsHit + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2397
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2398
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2399
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2400
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2401
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2402
			--end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2403
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2404
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2405
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2406
	-- if player is hit by circle bazooka
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2407
	elseif (GetGearType(gear) == gtShell) then --or (GetGearType(gear) == gtBall) then
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2408
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2409
		dist = GetDistFromGearToGear(gear, CurrentHedgehog)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2410
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2411
		if beam == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2412
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2413
			if dist < 3000 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2414
				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
  2415
				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
  2416
				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
  2417
				PlaySound(sndVaporize)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2418
				DeleteGear(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2419
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2420
				SK = SK + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2421
				if SK == 5 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2422
					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
  2423
					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
  2424
					AwardPoints(10)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2425
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2426
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2427
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2428
		elseif dist < 1600 then
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2429
			WellHeAintGonnaJumpNoMore(GetX(gear), GetY(gear), true)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2430
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2431
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2432
		--[[if targetHit == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2433
			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
  2434
			DeleteGear(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2435
			WriteLnToConsole("there, I deleted it")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2436
		end]]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2437
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2438
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2439
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2440
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2441
	if targetHit == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2442
			--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
  2443
			DeleteGear(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2444
			--nw WriteLnToConsole("there, I deleted it")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2445
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2446
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2447
	--nw WriteLnToConsole("End of CheckVarious()")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2448
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2449
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2450
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2451
-- collision detection for player entering a circle
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2452
function CheckDistances()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2453
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2454
	--nw WriteLnToConsole("Start of CheckDistances()")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2455
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2456
	for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2457
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2458
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2459
		--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
  2460
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2461
		g1X, g1Y = GetGearPosition(CurrentHedgehog)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2462
		g2X, g2Y = vCircX[i], vCircY[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2463
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2464
		g1X = g1X - g2X
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2465
		g1Y = g1Y - g2Y
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2466
		dist = (g1X*g1X) + (g1Y*g1Y)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2467
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2468
		--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
  2469
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2470
		--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
  2471
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2472
		-- 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
  2473
		if vCircType[i] == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2474
			NR = vCircRadius[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2475
		else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2476
			NR = (48/100*vCircRadius[i])/2
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2477
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2478
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2479
		if dist <= NR*NR then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2480
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2481
			if 	(vCircActive[i] == true) and
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2482
				((vType[i] == "ammo") or (vType[i] == "bonus") )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2483
			then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2484
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2485
				CircleDamaged(i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2486
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2487
			elseif (vCircActive[i] == true) and
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2488
					( (vType[i] == "drone") or (vType[i] == "blueboss") )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2489
			then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2490
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2491
				ss = CircleDamaged(i)
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2492
				local explosion
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2493
				if vType[i] == "blueboss" then explosion = true else explosion = false end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2494
				WellHeAintGonnaJumpNoMore(GetX(CurrentHedgehog),GetY(CurrentHedgehog),explosion)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2495
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2496
				if ss == "fatal" then
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2497
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2498
					if (wepAmmo[0] == 0) and (TimeLeft <= 9) then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2499
					--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
  2500
						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
  2501
						AwardPoints(15)
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2502
						PlaySound(sndKamikaze, CurrentHedgehog)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2503
					elseif (wepAmmo[0] == 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
  2504
						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
  2505
						AwardPoints(5)
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2506
						PlaySound(sndKamikaze, CurrentHedgehog)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2507
					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
  2508
						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
  2509
						AwardPoints(10)
12059
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2510
						PlaySound(sndKamikaze, CurrentHedgehog)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2511
					end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2512
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2513
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2514
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2515
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2516
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2517
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2518
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2519
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2520
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2521
	--nw WriteLnToConsole("End of CheckDistances()")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2522
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2523
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2524
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2525
function HandleCircles()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2526
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2527
	--[[if CirclesAreGo == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2528
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2529
		--CheckDistances()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2530
		--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
  2531
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2532
		--pTimer = pTimer + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2533
		--if pTimer == 100 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2534
		--	pTimer = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2535
		--	runOnGears(ProjectileTrack)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2536
		--end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2537
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2538
	end]]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2539
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  2540
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2541
	if rAlpha ~= 255 then
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  2542
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2543
		rPingTimer = rPingTimer + 1
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2544
		if rPingTimer == 100 then
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2545
			rPingTimer = 0
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  2546
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2547
			rAlpha = rAlpha + 5
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2548
			if rAlpha >= 255 then
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2549
				rAlpha = 255
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  2550
			end
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2551
		end
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  2552
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2553
	end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2554
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2555
	for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2556
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2557
		--if (vCircActive[i] == true) then
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  2558
			SetVisualGearValues(rCirc[i], rCircX[i], rCircY[i], 100, 255, 1, 10, 0, 40, 3, vCircCol[i]-rAlpha)
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2559
		--end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2560
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2561
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2562
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2563
		vCounter[i] = vCounter[i] + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2564
		if vCounter[i] >= vCounterLim[i] then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2565
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2566
			vCounter[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2567
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2568
			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
  2569
				(vCircActive[i] == true) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2570
				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
  2571
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2572
				--WriteLnToConsole("Circle " .. i .. " just fired/added a gtShell")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2573
				--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
  2574
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2575
			--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
  2576
			--	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
  2577
			--	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
  2578
			--	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
  2579
			--	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
  2580
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2581
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2582
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2583
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2584
		if (vCircActive[i] == true) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2585
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2586
			vCircRadCounter[i] = vCircRadCounter[i] + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2587
			if vCircRadCounter[i] == 100 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2588
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2589
				vCircRadCounter[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2590
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2591
				-- 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
  2592
				if vCircType[i] == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2593
					M = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2594
				else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2595
					M = 10
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2596
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2597
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2598
				vCircRadius[i] = vCircRadius[i] + vCircRadDir[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2599
				if vCircRadius[i] > vCircRadMax[i] then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2600
					vCircRadDir[i] = -M
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2601
				elseif vCircRadius[i] < vCircRadMin[i] then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2602
					vCircRadDir[i] = M
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2603
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2604
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2605
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2606
				-- random effect test
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2607
				-- 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
  2608
				-- you can kill by shooting or not
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2609
				--vgtSmoke vgtSmokeWhite
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2610
				--vgtSteam -- nice long trail
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2611
				--vgtDust -- short trail on earthrise
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2612
				--vgtSmokeTrace
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2613
				if vType[i] == "ammo" then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2614
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2615
					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
  2616
					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
  2617
					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
  2618
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2619
					--AddVisualGear(vCircX[i], vCircY[i], vgtDust, 0, true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2620
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2621
				elseif vType[i] == "bonus" then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2622
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2623
					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
  2624
					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
  2625
					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
  2626
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2627
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2628
				elseif vType[i] == "blueboss" then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2629
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2630
					k = 25
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2631
					g = vgtSteam
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2632
					trailColour = 0xae00ffff
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2633
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2634
					-- 0xffae00ff -- orange
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2635
					-- 0xae00ffff -- purp
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2636
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2637
					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
  2638
					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
  2639
					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
  2640
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2641
					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
  2642
					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
  2643
					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
  2644
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2645
					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
  2646
					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
  2647
					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
  2648
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2649
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2650
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2651
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2652
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2653
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2654
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2655
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2656
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2657
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2658
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2659
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2660
	-- alter the circles velocities
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2661
	circAdjustTimer = circAdjustTimer + 1
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2662
	if circAdjustTimer == 2000 then
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2663
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2664
		circAdjustTimer = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2665
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2666
		for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2667
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2668
			-- 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
  2669
			-- or make them move in random directions
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2670
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2671
			if vCircX[i] > 5500 then
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2672
				vCircDX[i] = -5	--5 circmovchange
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2673
			elseif vCircX[i] < -1500 then
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2674
				vCircDX[i] = 5	--5 circmovchange
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2675
			else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2676
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2677
				z = GetRandom(2)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2678
				if z == 1 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2679
					z = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2680
				else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2681
					z = -1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2682
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2683
				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
  2684
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2685
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2686
			if vCircY[i] > 1500 then
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2687
				vCircDY[i] = -5	--5 circmovchange
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2688
			elseif vCircY[i] < -2900 then
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2689
				vCircDY[i] = 5	--5 circmovchange
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2690
			else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2691
				z = GetRandom(2)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2692
				if z == 1 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2693
					z = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2694
				else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2695
					z = -1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2696
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2697
				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
  2698
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2699
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2700
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2701
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2702
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2703
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2704
	-- move the circles according to their current velocities
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2705
	m2Count = m2Count + 1
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2706
	if m2Count == 25 then	--25 circmovchange
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2707
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2708
		m2Count = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2709
		for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2710
			vCircX[i] = vCircX[i] + vCircDX[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2711
			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
  2712
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  2713
			if (CurrentHedgehog ~= nil) and (rAlpha ~= 255) then
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  2714
				DoHorribleThings(i)--(i, g1X, g1Y, g2X, g2Y, dist)
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2715
			end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2716
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2717
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2718
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2719
		if (TimeLeft == 0) and (tumbleStarted == true) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2720
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2721
			FadeAlpha = FadeAlpha + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2722
			if FadeAlpha >= 255 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2723
				FadeAlpha = 255
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2724
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2725
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  2726
			--new
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2727
			--if FadeAlpha == 1 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  2728
			--	AddCaption("GOT IT")
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2729
			--	for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2730
			--		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
  2731
			--		vCircCol[i] = g10
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2732
			--	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2733
			--end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2734
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2735
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2736
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2737
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2738
		-- derp
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2739
		if shockwaveHealth > 0 then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2740
			shockwaveHealth = shockwaveHealth - 1
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2741
			shockwaveRad = shockwaveRad + 80
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2742
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2743
			--mrm = ((48/100*shockwaveRad)/2)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2744
			--AddVisualGear(GetX(CurrentHedgehog)-mrm+GetRandom(mrm*2),GetY(CurrentHedgehog)-mrm+GetRandom(mrm*2), vgtSmoke, 0, false)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2745
		end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2746
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2747
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2748
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2749
	end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2750
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2751
	for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2752
		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
  2753
		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
  2754
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2755
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2756
	if 	(TimeLeft == 0) or
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2757
		((tumbleStarted == false)) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2758
		for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2759
			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
  2760
			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
  2761
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2762
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2763
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2764
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2765
	if (CurrentHedgehog ~= nil) then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2766
		if beam == true then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2767
			g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(pShield)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2768
			--SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, 200, g9, g10 )
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2769
			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, 200, g9, 0xa800ffff-0x000000ff - -shieldHealth )
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2770
			DrawTag(2)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2771
		else
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2772
			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, 0, g9, g10 )
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2773
		end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2774
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2775
		if shockwaveHealth > 0 then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2776
			g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(shockwave)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2777
			SetVisualGearValues(shockwave, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, shockwaveRad, g9, 0xff3300ff-0x000000ff - -shockwaveHealth )
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2778
		else
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2779
			SetVisualGearValues(shockwave, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, 0, g9, g10 )
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2780
		end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2781
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2782
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2783
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2784
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2785
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2786
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2787
function ProjectileTrack(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2788
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2789
	if (GetGearType(gear) == gtShell) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2790
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2791
		--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
  2792
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2793
		-- newnew
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2794
		if (GetGearType(gear) == gtShell) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2795
			turningSpeed = 0.1*fMod
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2796
		--elseif (GetGearType(gear) == gtBall) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2797
		--	turningSpeed = 0.2*fMod
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2798
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2799
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2800
		dx, dy = GetGearVelocity(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2801
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2802
		--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
  2803
		--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
  2804
		--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
  2805
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2806
		if GetX(gear) > GetX(CurrentHedgehog) then
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2807
			dx = dx - turningSpeed--0.1
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2808
		else
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2809
			dx = dx + turningSpeed--0.1
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2810
		end
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2811
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2812
		if GetY(gear) > GetY(CurrentHedgehog) then
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2813
			dy = dy - turningSpeed--0.1
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2814
		else
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2815
			dy = dy + turningSpeed--0.1
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2816
		end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2817
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2818
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2819
		if (GetGearType(gear) == gtShell) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2820
			dxlimit = 0.4*fMod
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2821
			dylimit = 0.4*fMod
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2822
		--elseif (GetGearType(gear) == gtBall) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2823
		--	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
  2824
		--	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
  2825
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2826
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2827
		if dx > dxlimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2828
			dx = dxlimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2829
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2830
		if dy > dylimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2831
			dy = dylimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2832
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2833
		if dx < -dxlimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2834
			dx = -dxlimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2835
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2836
		if dy < -dylimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2837
			dy = -dylimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2838
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2839
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2840
		SetGearVelocity(gear, dx, dy)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2841
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2842
		--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
  2843
		--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
  2844
		--nw WriteLnToConsole("ProjectileTrack() finished successfully")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2845
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2846
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2847
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2848
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2849