Game dev journal
Week 6
Today I began thinking of ideas as to what I should create as a mechanic I was split between two ideas. One being a basic recreation of the tanks minigame from Wii Play (2006) by building on the base that was created through the programming fundamentals tasks. The other being a 2d static platformer shooter where I would have to create the ai from scratch and change the shooting for players
I decided to focus on the shooter as creating everything again will give me time to improve using what I have learnt and will give me greater control than the base we already have. I created the player block and worked on collisions, however I had ran into an issue with the way I drew the block which lead to issues with collisions and adding the gun that points to the cursor. I had to fix the draw function to get the gun rotating correctly
Today I finished implementing collision detection using the AABB method outlined on the Mozilla website (Mozilla 2020). I used this method because I want my prototype to be made of simple blocks and this collision detection method will work best with those and it also means that the system can be easily applied to all of the objects I want it to. I created an array to keep track of all colliders at the moment I have to manually add each collider to the array which will not work once I create enemy spawning but this was purely to test the collisions. An issue I ran into was that the collision would never detect I later found out that this was because I had not been checking the colliders parent, because of the way that I have made colliders they are their own separate object that you can add to an object this is to make adding collisions easier to objects with minor tweaking between each, but the colliders don’t have an x, y, width, height because that’s all stored in the parent and when I forgot to specify parent the script would just ignore the if statement. However that is now fixed and it properly detects when a collision has occurred.
Today I finished the colliders by adding a system to act once a detection occurs. It first determines what side / direction the collision occurred in and then pushes the two away from each other the biggest issues with this system is that the two objects can sink into each other if they keep trying to move inwards. I added bullets into the prototype but at the minute they are not working with the position being reported as NaN. I also added the enemies
References:
Nintendo (2006), Wii Play [Video Game], Nintendo
2D collision detection 2020, Mozilla, viewed 30October 2020, https://developer.mozilla.org/en-US/docs/Games/Techniques/2D_collision_detection