Categories
Uncategorised

Game Dev Journal Week 7

Today I fixed the bullets as the speed variable was being defined incorrectly and I then implemented enemy death, I first tried to use a splice in the array to delete the enemy when this didn’t work I added an active state and had the enemy update only when it was active but this has lead to another issue with the enemies collider staying back when the enemy dies, so far I have tried to set the collider to a trigger once  the enemy dies so that objects can move past the inactive enemy. This has worked for the enemies but the player still bumps into these inactive objects.

Today I fixed the enemies having active colliders after death and also made it so that the dead enemies respawn, I did this by changing the parameters for the enemy check where before it would check that the array length was below the max enemies (10) now it just checks that the array contains null or inactive enemies. As for the collider issue I’ve fixed it by adding active states to every object and having the collider make sure that the objects are active before performing the functions. I have also made the bullets become inactive on enemy hit, this is so that the enemies require more than 1 hit to defeat and so that the bullets don’t pierce through every enemy. I accomplished this by having the collider check the tags of the objects and making the bullet inactive. Currently the bullet has minor collision, this can lead to the player getting pushed or sometimes stopped for a moment by the bullet, if the player fires  the bullet to their left then the bullet pushes them right for a moment after it spawns

A little later I created a system to limit the framerate based on code from JsFiddle(Http://jsfiddlenet/m1erickson/CtsY3/). I used this because many issues were arising from seconds passing to fast and movement issues, now I can set the target framerate easily and base certain variables around that.

References:
Jsfiddle. [no date]. Http://jsfiddlenet/m1erickson/CtsY3/. [Online]. [9 November 2020]. Available from: http://jsfiddle.net/m1erickson/CtsY3/

Categories
Uncategorised

Game Dev Journal Week 6

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