Post 101
Today I am doing my blog for Fridays class, the reason I delayed this post was so I could add a lot to it and make up for some of the more lack luster posts of this month. Last blog post I said something along the lines of "Next class I will either do, Crashing into walls, Shooting, and maybe even a proper space background". But instead of doing one of those I did all three. And an added bonus of enemy ships.
The Final Frontier
So first off lets talk about the brand new fancy space background, nothing to special in the technical department, but it sure looks good. This background is 500 by 500 pixels big. Currently its set to tile itself across the room creating a vast open space of, well space. The way I created it was fairly simple, I started by just making a 100% black image and used the "Add noise" function, this basically just puts a bunch of dots all over the screen. I then played around with the coverage and lowered it so the dots didn't cover up every last inch of space in the picture. Then I stripped the image of its colour and created another layer, painted that layer 100% purple, then I reduced the layers opacity, making the background slightly purple. This gives it a very old-timey cosmic feel. Hopefully you, the reader, enjoy this background as much as I do.
Collisions
The next thing I started to work on was Collisions, this was fairly complicated but luckily Howie showed me some of his magic tricks and helped me create it. So for the Collisions to work properly outside of the GML physics system, I needed some fancy pants code. The following code is extremly confusing and I am not entirely sure what it exactly does. But I will ask Howie more about it and see if I can learn how to create it without any assistance.The code is located in a collision event inside a Parent Object. A parent Object is kind of like having genetics in code, you make another object the "Child" of the parent and it passes on its "Genes", the genes being a line of code. This parent Object is the master of all collisions, any object that can bump into things is put into it as a line of code, this way I don't need to have a collision code for every combination of every possible collision inside every collision object.
Crashing
That is the collisions setup, but it wouldn't look good without a fancy explosion when the player crashed now would it? No, it wouldn't.So this is how I made a super cool implosion/explosion looking thing.
So here is a picture of the Death_Script. Basically what it does is when the players health is equal to 0, or below 0, the explosion object is created and a bunch of other cool looking settings that you can read for yourself. The second picture is the code inside the explosion object itself. That code just tells the explosion to restart the room when it finishes its animation.
Finally, the end of the collision code, the part we have all been waiting for... The EXPLOSION.
Shooting Lasers and Enemy Ships
Finally I added Shooting, and enemies. Currently both are pretty lame and not the best that they could be, especially the enemy ships. All they currently do is aimless fly towards you hitting everything in there path. The code for all the objects and things that go into making an object shoot is pretty minimal, so i'm not going to bother putting it into the blog, but basically it just creates an object that sets its direction and speed to the last location of the mouse at the time you pressed the shoot button. Here is a demonstration in GIF form. This properly shows off the visual aspects of shooting and destroying enemies in my game.And the AI, isn't AI it just spawns, turns towards you and moves. Obviously in the future I wish to change this and have the ships move towards you in a more random intelligent way, or maybe even shoot back rather then kamikaze into you.
No comments:
Post a Comment