Categories
Uncategorised

Week 25/01/21

This week we needed to make a platformer but we had 2 big differences from how we usually make them. 1, we controlled it through dragging the pointer across the screen. 2, we made it using a different physics system called matter.

The matter system is much more complex than the arcade system we were using and it allows the creation of more complex shapes and systems such as bridges, cloth and ropes. In my customization I used bridges however I will get to this later.

We made a player character that used touch in order to move, the user would drag across the screen and the character would interpret this in one of 3 directions; up, left and right however I changed this in my customization where I made it so that whenever the player drags, where they drag to and how far they drag affects the players direction and speed (with a max speed of course). The amount they dragged was divided by the map’s width and height in order to shrink the speed down to something viewable and controllable otherwise the player clipped through the world bounds at the top of the screen

In my customization I had also added a bridge to the first level for the player to stand on

In order to create this bridge I used an example on the phaser website (Phaser 3, 2021). I modified the code to only the section that creates the bridge as I had no need for dragging the bridge with the mouse or having the two pillars the bridge connects to

Overall I found the matter physics engine more complex than the arcade but the complexity gave more control and ability to add more interesting things such as bridges and cloth

References:

Labs.phaser.io. 2021. Phaser 3. [online] Available at: <http://labs.phaser.io/view.html?src=src/physics/matterjs/bridge.js> [Accessed 25 January 2021].

Categories
Uncategorised

Week 12/01/21

This week we were asked to create a simple tank game in phaser including player and enemy tanks, movement, shooting, destructable walls. This project taught us how to use custom properties and texture atlases gave us a very simple enemy ai where they would move straight in a direction until they hit a wall where they would turn bounce off of it perpendicular to where they came from

A big thing we learnt from this project was the implementation of classes and classes that extend from a base. During this project we needed to create a BaseTank class that would hold all of the functions and variables that would be needed to extend off of for the other classes. This was a big change from having all of our functions and variables inside of a singular file and this made it easier to find what we needed inside of it and made it easier to sort.

The basetank class needed a constructor in order to set it up, the tank is made up of three parts for it to work correctly, the turret for spawning the bullets, the hull for collision and movement and the shadow for nicer visuals. Inside of update these three need to be lined up correctly