I'm coding a game - Part 5

Sorry for the delay everybody, this installment threw a curve ball at me. Let’s start with importing the artwork I got from Adam. For some reason when I imported it, some of the files got rid of the transparent background. I then tried to make a transparent background in MS Paint only to find out, MS paint will not save a transparent background. I spent way too much time trying to do this when the whole time GameMaker Studio 2 has a feature to put transparent backgrounds in pictures.
The next step was to make the sprites into objects and assign it some properties. Now if you recall from my first installment, I had already defined a set of properties for the main character. This new character or object would be sharing the some of the same type of properties such as gravity, how the animation runs, and some others. Rather than coding the exact same code, it was easier just to cut and paste.

Ahhh…Control C and Control V, is there anything you can’t do?

As you can see, the collisions for the object are exactly the same. Next I created some new variables for the enemy object.

The flash variable was a variable I used along with the “Shader” resource. This resource allows a coder to alter the pixels of an object in a variety of ways. Tweaking with the shader a coder can make an object darker, lighter, or change colors completely. I wanted to simulate the effect of the enemy lighting up when stuck by the player’s bullet. It just gives it that finishing touch feel, and a lot of these games can be hard to tell if enemy is hit or not.

The last bit of code I worked was the dying animation. With this code I set the hit points with the variable hp. When the hp is equal or less than zero, it runs the dying sequence.

This little bit of code will simulate the enemies body being pushed by the force of the bullet as it is dying.
All in all I noticed the coding becoming a little more complex. I still can understand it, but it’s getting to the point where I really have to stare at it awhile to understand it. What I do find helpful is the program will notify you if a line of code is incorrect in real time. The last time I programmed something that feature was not available .. of course, the last time I attempted to program something was 20 years ago… and it was on a 20 year old mainframe…
…I was pretty cool.