Difference between revisions of "Ideas for triggers"

From Bitfighter
(Added function proposals)
Line 1: Line 1:
 
A working list of ideas for triggers that could cause execution of code in a robot or supervisor script.  Remember that robots are a kind of ship, so, generally, there's no need differentiate the two.
 
A working list of ideas for triggers that could cause execution of code in a robot or supervisor script.  Remember that robots are a kind of ship, so, generally, there's no need differentiate the two.
 
+
//Unknown: Would this be easier do to with functions that return booleans rather than a bunch of events?
 
<pre>
 
<pre>
 
onLevelStart()  // Called after level is loaded and is ready to go.
 
onLevelStart()  // Called after level is loaded and is ready to go.
Line 16: Line 16:
 
onShipDamaged(ship, damager)
 
onShipDamaged(ship, damager)
 
onShipKilled(ship, killer)
 
onShipKilled(ship, killer)
 +
onShipFiring(ship, weapon, bullet) 
 +
onShipUsingModule(ship, module)
  
 
onPlayerAboutToJoinGame(ship)  // Called just before player joins
 
onPlayerAboutToJoinGame(ship)  // Called just before player joins
Line 61: Line 63:
 
onSoccerGoalScored(ball, goal, scorer)
 
onSoccerGoalScored(ball, goal, scorer)
 
onSoccerBallReset(ball) (when ball actually arrives back at starting position)
 
onSoccerBallReset(ball) (when ball actually arrives back at starting position)
 +
</pre>
 +
<pre>
 +
//Section by Unknown
 +
//Drawing functions
 +
drawSetColor(col) //col is a hex uint - 0xFFFF00 is yellow
 +
drawSetAlpha(amount) //amount is a value 0-1
 +
drawMove(x,y) //moves the pen to the specified position
 +
drawLine(x,y) //draws a line from the pen's current position to the specified position
 +
drawRectangle(x1,y1,x2,y2)
 +
drawCircle(x,y,r)
 +
drawEllipse(x1,y1,x2,y2)
 +
 +
//Functions that modify the game objects
 +
removeObject(object || marker)
 +
addObject(levelLine || (object, objectArgs))
 +
translateObject(object || marker, x, y)
 +
rotateObject(object || marker, x, y, amount)
 +
flipObject(object || marker, vertically) //vertically is a boolean that determines which direction it is flipped in
 +
 +
//Functions that modify the ship's properties
 +
Ship:setEnergy(ship,amount)
 +
Ship:getEnergy(ship)
 +
Ship:setHealth(ship,amount)
 +
Ship:getHealth(ship)
 +
Ship:setMaxSpeed(ship,maxSpeed)
 +
Ship:getMaxSpeed(ship)
 +
Ship:setMaxBoostSpeed(ship,maxSpeed)
 +
Ship:getMaxBoostSpeed(ship)
 +
Ship:setFriction(ship,amount)
 +
Ship:getFriction(ship)
 +
destroyShip(ship) //may not be necessary because setShipHealth(ship,0) could be used
 
</pre>
 
</pre>

Revision as of 16:18, 13 March 2010

A working list of ideas for triggers that could cause execution of code in a robot or supervisor script. Remember that robots are a kind of ship, so, generally, there's no need differentiate the two. //Unknown: Would this be easier do to with functions that return booleans rather than a bunch of events?

onLevelStart()  // Called after level is loaded and is ready to go.
onTick()        // Called every frame

// Here, zone could be any polygonal entity: loadout zones, nexus, goal zones, etc.
onShipEnteredZone(ship, zone) 
onShipLeftZone(ship, zone)

onFlagGrabbed(flag, ship)
onFlagDropped(flag, dropper)

onShipAboutToSpawn(ship)        // Called just before player spawns
onShipSpawned(ship)             // Called just after player spawns
onShipDamaged(ship, damager)
onShipKilled(ship, killer)
onShipFiring(ship, weapon, bullet)  
onShipUsingModule(ship, module)

onPlayerAboutToJoinGame(ship)   // Called just before player joins
onPlayerJoinedGame(ship)        // Called just after player joins
onPlayerQuitGame(ship)


onTurretKilled(turret, killer)
onAllTurretsKilled(team)
onForceFieldKilled(forcefield, killer)
onAllForceFieldKilled(team)

onTeamScored(team, score, scoringEvent, scoringShip)
onIndividualScored(scoringShip, score, scoringEvent)
onLeadingTeamChanged(team, previousLeadingTeam)
onLeadingPlayerChanged(player, previousLeadingPlayer)

onAsteroidSpawned(asteroid)
onAsteroidShot(asteroid, shooter)
onAsteroidDestroyed(asteroid, shooter)

onHealthPackUsed(healthpack, ship)
onHealthPackReplenished(healthpack)


onTurretSelectedTarget(turret, target)
onTurretFired(turret, target)

// Game specific events: named on<Game>EventName

onNexusOpen(nexus)
onNexusClose(nexus)
onNexusFlagCollected(flag, ship)

onRabbitKilled(rabbit, killer)
onRabbitGrabbedFlag(rabbit)

onZoneControlZoneCaptured(zone, capturer)
onZoneControlTouchDownScored(scoringShip) ( or onZonesReset() )

onHTFFlagReturnedToZone(flag, zone, returner)
onHTFFlagRemovedFromZone(flag, zone, taker)

onSoccerBallPossesionChanged(ball, possessingShip, previousPossesser)
onSoccerGoalScored(ball, goal, scorer)
onSoccerBallReset(ball) (when ball actually arrives back at starting position)
//Section by Unknown
//Drawing functions
drawSetColor(col) //col is a hex uint - 0xFFFF00 is yellow
drawSetAlpha(amount) //amount is a value 0-1
drawMove(x,y) //moves the pen to the specified position
drawLine(x,y) //draws a line from the pen's current position to the specified position
drawRectangle(x1,y1,x2,y2)
drawCircle(x,y,r)
drawEllipse(x1,y1,x2,y2)

//Functions that modify the game objects
removeObject(object || marker)
addObject(levelLine || (object, objectArgs))
translateObject(object || marker, x, y)
rotateObject(object || marker, x, y, amount)
flipObject(object || marker, vertically) //vertically is a boolean that determines which direction it is flipped in

//Functions that modify the ship's properties
Ship:setEnergy(ship,amount)
Ship:getEnergy(ship)
Ship:setHealth(ship,amount)
Ship:getHealth(ship)
Ship:setMaxSpeed(ship,maxSpeed)
Ship:getMaxSpeed(ship)
Ship:setMaxBoostSpeed(ship,maxSpeed)
Ship:getMaxBoostSpeed(ship)
Ship:setFriction(ship,amount)
Ship:getFriction(ship)
destroyShip(ship) //may not be necessary because setShipHealth(ship,0) could be used