Hazards¶
Boo¶
The Mario Ghost Boo.
Boo is a hazard that moves straight towards the player, ignoring intervening terrain.
Class is currently defunct, because speech is not a valid argument for a SpriteActor.
Constructor
Boo (start, costume, collision[, scale, run, ...]) |
The Mario Ghost Boo. |
Methods
step () |
Moves Boo one step. |
Details
-
class
Boo
(start, costume, collision, scale=1, run=True, debug=False, speech=True)[source]¶ Bases:
actors.spriteActor.SpriteActor
Constructs a Boo object.
Parameters: - start – The starting position of Boo.
- costume – Interger indicating the starting position of Boo. The costumes come in the following order: left, right.
- collision – The collision function called when something hits Boo.
- scale – The scale of Boo’s sprite.
- run – Whether or not Boo should be immediately active.
- debug – Whether debug visuals should be enabled (shows the hitbox).
- speech – No longer a valid argument.
Methods
Boulder¶
A boulder.
Class looks disfunctional.
Constructor
Boulder (start, collision[, scale, speed, ...]) |
A boulder. |
Methods
step () |
Should perform one step of the boulder, but the self.orbit attribute is not an actual attribute of this boulder, so this function would usually crash. |
Details
-
class
Boulder
(start, collision, scale=1, speed=1, debug=False, obstructs=True)[source]¶ Bases:
actors.spriteActor.SpriteActor
Creates a Boulder object.
Parameters: - start – The starting position of the boulder.
- collision – Function called when something hits the boulder.
- scale – The scale of the boulder.
- speed – The speed of the boulder.
- debug – Whether debug visuals should be enabled (shows the hitbox).
- obstructs – Whether or not the boulder should obstruct movement.
Methods
FireBall¶
A fireball that moves back and forth.
Constructor
FireBall (start, end, costume, collision[, ...]) |
A fireball that moves back and forth. |
Methods
disable () |
Disables the hazard. |
isDisabled () |
Indicates whether this hazard is enabled or not. |
step () |
Move the fireball one step. |
Details
-
class
FireBall
(start, end, costume, collision, scale=1, speed=10, run=True, debug=False, startLoc=None, bounce=True)[source]¶ Bases:
hazards.Hazard
,actors.spriteActor.SpriteActor
Creates a FireBall object.
Parameters: - start – The starting position of the fireball.
- end – The end position of the fireball.
- costume – Integer indicating the initial costume of the fireball. The customes come in this order: up, down, left, right.
- collision – The collision function called when something hits the fireball.
- scale – The scale of the fireball.
- speed – The speed of the fireball.
- run – Whether or not the fireball should immediately active.
- debug – Whether debug visuals should be enabled (shows the hitbox).
- startLoc – Set if the starting position should be different from the patroll starting point.
- bounce – If True, the fireball will move back-and-forth. If False, the fireball will respawn at the start position when it reaches the end position.
Methods
FireBall2¶
Experimental fireball that can use multiple waypoints.
Constructor
FireBall2 ([waypoints, costume, collision, ...]) |
Experimental fireball that can use multiple waypoints. |
Methods
defaultCollide (myfixture, otherfixture, contact) |
Default collision function that sets a game over if the robot touches the fireball. |
draw (levelWindow) |
Draws the fireball to the level. |
pause () |
Temporarily stops the fireball from moving. |
reverse () |
Causes the fireball to start moving in the opposite direction. |
start () |
Causes the fireball to start moving. |
stop () |
Stops the fireball by deleting its move event. |
unpause () |
Causes the fireball to continue to move if it was paused. |
warp () |
Warps the fireball back to the starting point. |
Details
-
class
FireBall2
(waypoints=[], costume=0, collision=None, scale=1, speed=10, run=True, debug=False, startLoc=None, bounce=True)[source]¶ Bases:
hazards.Hazard
,actors.spriteActor.SpriteActor
Creates a FireBall object.
Parameters: - waypoints – List of waypoints that fireball will follow.
- costume – Integer indicating the initial costume of the fireball. The customes come in this order: up, down, left, right.
- collision – The collision function called when something hits the fireball.
- scale – The scale of the fireball.
- speed – The speed of the fireball.
- run – Whether or not the fireball should immediately active.
- debug – Whether debug visuals should be enabled (shows the hitbox).
- startLoc – Set if the starting position should be different from the patroll starting point.
- bounce – If True, the fireball will move back-and-forth. If False, the fireball will respawn at the start position when it reaches the end position.
Methods
-
defaultCollide
(myfixture, otherfixture, contact)[source]¶ Default collision function that sets a game over if the robot touches the fireball.
Parameters: - myfixture – Fixture of the fireball.
- otherfixture – Fixture of whatever we collided with.
- contact – The contact of the collision.
-
draw
(levelWindow)[source]¶ Draws the fireball to the level.
Parameters: levelWindow – The LevelWindow
to draw to.
Grinder¶
A spinning blade that may follow a circular path.
Constructor
Grinder (start, collision[, scale, ...]) |
A spinning blade that may follow a circular path. |
Methods
disable () |
Disables the hazard. |
isDisabled () |
Indicates whether this hazard is enabled or not. |
step () |
Move the grinder one step. |
Details
-
class
Grinder
(start, collision, scale=1, rotationSpeed=1, debug=False, orbit=False, orbitCenter=(0, 0), orbitRadius=100, orbitStep=0.25, currentAngle=0, run=True)[source]¶ Bases:
hazards.Hazard
,actors.spriteActor.SpriteActor
Creates a Grinder object.
Parameters: - start – The starting position of the grinder.
- collision – Function called when something hits the grinder.
- scale – The scale of the grinder.
- rotationSpeed – The rotational speed of the grinder.
- debug – Whether debug visuals should be enabled (shows the hitbox).
- orbit – Whether or not the grinder should move in a circle.
- orbitCenter – The center around which the grinder moves.
- orbitRadius – The distance from the center around which the grinder moves.
- orbitStep – The speed at which the grinder moves.
- currentAngle – The angle at which the grinder starts its movement.
- run – Whether or not the grinder should be immediately active.
Methods
Hazard¶
Base object for all hazards.
Constructor
Hazard () |
Base object for all hazards. |
Instance Attributes
run |
Indicates whether or not this hazard is disabled. |
Methods
disable () |
Disables the hazard. |
isDisabled () |
Indicates whether this hazard is enabled or not. |
Details
Kuka¶
A robot enemy that monitors the past locations of the robot and simple follows those past locations to follow the robot.
Constructor
Kuka (start[, hitMessage, hitPause, ...]) |
A robot enemy that monitors the past locations of the robot and simple follows those past locations to follow the robot. |
Methods
findClosestWayPoint (p) |
Finds the closest waypoint to the provided position. |
hitCollide (myfixture, otherfixture, contact) |
The collision function of the Kuka. |
hitFlash () |
Function causes the Kuka to blink. |
hitSeparation (myfixture, otherfixture) |
Records when the Kuka leaves a portal. |
recordWayPoints () |
Records the current position of the robot as a waypoint. |
step () |
Move the Kuka one step. |
stopMotion () |
Stops the movement of the Kuka. |
Details
-
class
Kuka
(start, hitMessage=None, hitPause=20, hitAction=None, speed=10, obstructs=False, visible=True, bodyType='dynamic', scale=1, debug=False)[source]¶ Bases:
actors.spriteActor.SpriteActor
Constructs a Kuka object.
Parameters: - start – The starting position of the Kuka.
- hitMessage – A message shown when the Kuka is hit.
- hitPause – The amount of time the Kuka waits after it is hit.
- hitAction – Function executed when the Kuka is hit.
- speed – The speed of the Kuka.
- obstructs – Whether or not the Kuka obstructs pathing.
- visible – Whether or not the Kuka is visible.
- bodyType – Either ‘static’ or ‘dynamic’.
- scale – The scale of the Kuka Sprite.
- debug – Whether debug visuals should be enabled (shows the hitbox).
Methods
-
findClosestWayPoint
(p)[source]¶ Finds the closest waypoint to the provided position.
Parameters: p – The point from which we to find the closest waypoint. Return: The waypoint closest to the point p.
-
hitCollide
(myfixture, otherfixture, contact)[source]¶ The collision function of the Kuka.
Parameters: - myfixture – The fixture of the Kuka.
- otherfixture – The fixture of the other object.
- contact – The contact of the collision.
Missile¶
A missle that follows a set of waypoints, and explodes on contact.
Constructor
Missile ([waypoints, speed, run, startLoc, atEnd]) |
A missle that follows a set of waypoints, and explodes on contact. |
Methods
defaultCollide (myfixture, otherfixture, contact) |
Default collision function that sets a game over if the robot touches the missle. |
draw (levelWindow) |
Draws the missile to the level. |
pause () |
Temporarily stops the fireball from moving. |
reset () |
Moves the missile back to the starting position. |
reverse () |
Causes the missile to start moving in the opposite direction. |
start () |
Causes the missile to start moving. |
stop () |
Stops the missile by deleting its move event. |
unpause () |
Causes the missile to continue to move if it was paused. |
warp () |
Warps the missile back to the starting point. |
Details
-
class
Missile
(waypoints=[], speed=10, run=True, startLoc=None, atEnd='bounce', **kwargs)[source]¶ Bases:
hazards.Hazard
,actors.spriteActor.SpriteActor
Creates a Missile object.
Parameters: - waypoints – List of waypoints that missile will follow.
- speed – The speed of the missile.
- run – Whether or not the missile should immediately active.
- startLoc – Set if the starting position should be different from the patroll starting point.
- atEnd – If set to ‘bounce’ will cause the missle to move back-and-forth, if set to ‘warp’ will cause the missle to warp back to the start, if set to ‘circle’ will move to the start when the end is reached, if set to ‘stop’ the missle will be disabled after reaching the end, and if set to ‘custom’ a callback function will be called to determine what happens.
- kwargs – All other keyword arguments will be passed to the parent
SpriteActor
.
Methods
-
defaultCollide
(myfixture, otherfixture, contact)[source]¶ Default collision function that sets a game over if the robot touches the missle.
Parameters: - myfixture – Fixture of the missle.
- otherfixture – Fixture of whatever we collided with.
- contact – The contact of the collision.
-
draw
(levelWindow)[source]¶ Draws the missile to the level.
Parameters: levelWindow – The LevelWindow
to draw to.
Thwomp¶
A Mario Thwomp that moves up and down.
Constructor
Thwomp (start, end, costume, collision[, ...]) |
A Mario Thwomp that moves up and down. |
Methods
disable () |
Disables the hazard. |
isDisabled () |
Indicates whether this hazard is enabled or not. |
step () |
Move the thwomp one step. |
Details
-
class
Thwomp
(start, end, costume, collision, scale=1, upSpeed=10, downSpeed=20, run=True, debug=False, startLoc=None, bounce=True, onStep=None, hitbox=None)[source]¶ Bases:
hazards.Hazard
,actors.spriteActor.SpriteActor
Creates a Thwomp object.
Parameters: - start – The starting position of the thwomp.
- end – The end position of the thwomp.
- costume – Integer indicating the initial costume of the thwomp. The customes come in this order: up, down.
- collision – The collision function called when something hits the thwomp.
- scale – The scale of the thwomp.
- upSpeed – The upward speed of the thwomp.
- downSpeed – The downward speed of the thwomp.
- run – Whether or not the fireball should immediately active.
- debug – Whether debug visuals should be enabled (shows the hitbox).
- startLoc – Set if the starting position should be different from the patroll starting point.
- bounce – If True, the fireball will move back-and-forth. If False, the fireball will respawn at the start position when it reaches the end position.
- onStep – Function called at every movement step of the thwomp.
- hitbox – A custom hitbox for the thwomp, useful if it scalled to a different size.
Methods