I made the mistake today of doing a raid. If you want to lose 4 to 5 hours of your day that is a great way to do it! But I did make some progress! The snowball has been added, the ability to destroy the snowball has been added, and the mouse is now a flipper!
I may change the mouse so that when you click it has a little animation to give it some more “pep” but for now we’ll just leave it as this static ridged sad thing. Helps to match how fun today was.
Originally I was having a problem with all the snowballs being the same size and borrowing from one another’s variables. This was maddening! I’m sitting here thinking its 11:30 at night, I’m tired as hell, but I’ll be damned if I’m missing a day of this project because of some stupid raid.
Then about a minute ago I had an epiphany and fixed it and now it works and I am delighted. I’m moving further and further away from regular button scripts and making my own. I’m just going to go over one tonight because I am so stupid tired that I swear I’m going to just slump over.
Here is the script that runs each time you click on Happy. It’s ugly but it works.
The first thing that happens is the game checks to see if Happy has a speed less than or equal to 1. If he does it will set him to 1. We don’t want happy stopping dead and letting you slap the shit out of him. That’s not very happy!
The next line is checking his speed to see if he’s going greater than or equal to 8! This is because once you get over 8 the speed is so grotesque that it can destroy your heart and soul. Now that I have this limiter in it is likely that I’m going to make him speed up faster because we can throw caution to the wind! I’m also aware I could shorten the text by making it an else if statement (which we can talk about sometime) but again in my work environment it is important to have lots of extra lines! That’s how you get paid. This game is basically work 30K in the KR market already.
The last bit is a bit of “genius?” that I created earlier. So each time you click him he will generate 2 snowballs. One will be in his left hand (roughly 50 pixels to the left of his center) and one will be in his right hand (roughly 50 pixels to the right of his center). The height at which they are will just be whatever his y coordinate is at the time because its pretty spot on. The object being created is the snowball obviously.
You might be saying “good lord man what is all that other nonsense after the X coordinate about?! Well we must remember that happy gets a little smaller each time you slap him. If you were always going 50 to the left or the right of him they’d start hovering outside of his range and just be flying at you from the ether!
Can’t have that – no no.
So what 50*obj_happyhappy.image_xscale does is take the current “scale” of happy and multiply it by 50! So if he’s at his normal size the value is 1. But if he’s say…50% of his normal size it will times 50 by .5 and get 25! This way no matter what his size big or small (as long as its an integer larger than 0) you will get the correct location of Happy’s hands!
Tomorrow we’ll start adding in the actual scoring and other perks [like HP]. I’m going to maybe look into adding sounds if everything looks to be finished. We are nearing the end of this little project but most certainly this is something that can be improved in the future!
I learned a lot about variables today and will go over that more tomorrow when my face isn’t melting.
I was thinking it would be interesting to give the antagonist (you) some traps you could place on the map that would do different things to Happy when he walked into them. Perhaps customer assistance themed things. You can download the latest version here! Edit: The original installer was broken. I’ve updated it to be functional now. (7/13/2011)
[ Table of Contents]