Some example code for the Monkey2 programming language
- Create a SpaceCraft class that extends Window
- Prepare some methods to draw and update the screen
- Make a GameObject Class which will be the base class for all our game objects
- Implement a simple Component class for giving game objects functionality
- Create a Player class with a control Component and get it drawing to the screen
- Enable the GameObject to have a Body and Space and set up an InitPhysics method
- Add a chipmunk Space in the SpaceCraft class.
- Write some maintainence functions to handle adding and removing from the Space
- Use a Chipmunk bounding box query to draw all objects on screen (in this case just the player).
- Build on the Controls component to define the player controls and get it moving about
- Use a chipmunk query to update objects that are on screen
- Create a Tilemap class and set some initial fields that we'll need
- Create some methods for converting screen coordinates into node coordinates and vice versa
- Set the origin vec in the Spacraft Class to the centre of the screen
- Test the coordinates for the tilemap are working ok.
- Create a TileLayer class and create some fields and methods that we'll need
- Add extra methods and fields to the TileMap class that we need
- Draw nodes to the screen with just a single block tile for each node to start with and test.
- Add a way to erase tiles
- Alter the AssignTiles method to create four tiles for each node
- Create AssignTile to assign the correct tile image according to surrounding nodes
- Update the erase method to erase all tiles as necessary.
- Import TimelineFX and load in the effects library
- Add a class to create the different weapons and utilities the ship can fire/use
- Extend that class and make a laser beam class
- Add controls to the player to fire the laser on left mouse (update the map drawing controls to something else as well)
- Import TimelineFX and load in the effects library
- Add a class to create the different weapons and utilities the ship can fire/use
- Extend that class and make a laser beam class
- Add controls to the player to fire the laser on left mouse (update the map drawing controls to something else as well)
- Start with some bug fixing with the virtual screen resolution
- Create a segment query in chipmunk to handle the raycasting
- Add a sparks particle effect at the point of impact
- Add a particle effect for the player and a thruster effect too
- Set the texture filter to linear for more crisper graphics
- Use a matrix to calulate points on the player as it rotates to offset the laser and thrusters
- Make the maptiles destructable by giving them properties and the ability to take damage
- Add a glow effect for map tiles that are being mined
- Add an explosion effect for when a tile is destroyed
- Create a new RockObject class that extends Gameobject
- Use Chipmunk to handle the physics
- Give them an expirey so that they dissapear after a while
- Create the TractorBeam class and set up the activate/deactive methods
- Edit the player class to accomodate the tractor beam and add controls so that the it can be fired with right mouse
- Create a chipmunk segment query to handle the tractor beam hitting the map tiles
- Create a shape query to handle the rocks touching the beam and getting sucked up
-
Add a Chipmunk sensor to the player
-
Set up a collision handler for when the sensor hits a rock
-
Add an effect for when a rock is hit and use a lambda to position it as the player moves about