Tags

,

Last week I tried to make a collision between the power up and the player. When I tried to explain what my mission was to accomplish that week it came out a bit blurry. To make my first blog post more clear and not that blurry, I will clear some things up. My pick up file is the file that checks what you can pick up, it will check for specific collisions with blocks, in this case their will be a power up block that will allow you to activate it and fire laser projectiles that melts everything in its way. giraff.png

Now if the player collides with the power up, the pick up file will notice it and you will be able to activate it by pushing a button(Not yet declared). If the player chooses to activate it and start to fire at an enemy, it will get destroyed.

Namndddlös.png

The second thing that was mentioned as a blurry explanation was the shape, it works like a square of 4 points of a box with collision. The 4 points needs to be declared and you can set them where ever you decide them to be. So what I did was to set 4 point around the power up, so everything inside the 4 points are made a collision block. That way we can collide the power up and the giraff.

Naamnlös.png

Last thing that needed to be described in a better way was why the damage of the laser did so high amount of damage. This was a good point and our group decided to change the damage to “one hit”, instead of letting it do a specific damage percentage. So now when the player fires with a normal or with laser it will one hit the enemies(not the boss). What makes them different is that the normal projectiles are harder to hit because of the lesser radius of the projectile, and the laser have a long radius. Nevertheless it has a bigger width.

Namnlöfas.png

Now that I have made a collision between the player and power up I could continue on the next thing, which are the fire function and how it will work.

What I needed to do was to set the normal projectile function of when you click down left mouse button it fires to an else statement. Then I had to set a the other function of when I collide with the power up and activates it the projectiles should change to the laser. By solving this I set the laser projectile to: if the collision is done and you push the activate button, you should fire laser. Else you will fire the normal projectiles.

So the short version is that if you do collide with the power up and not push the activate button of that power up you should continue firing the normal projectiles, until you push down the activation button.