Thursday, November 26, 2015

Polishing Earth Survival Game


Polishing Earth Survival Game


How the game looks now 

Today I felt like polishing up my game so that I could move on and perhaps make a new game. I started out with 2 major things that I knew I needed to finish up. The first thing I had to do was make the asteroids remove the planet from the game. This was easy since I already knew what code I was going to use and so I just copy and pasted it and after some modifications, it worked. Then I decided to put in the ending into the game. This took a bit longer than making the code remover work since I was now working on two different classes and I wanted to make sure that everything worked. This fear and caution towards making the end game state was mainly due to my last game where it didn't work as I planned. Fortunately, this time it worked wonderfully and there were no problems what so ever. This was great for me since I was really worried that I would have to spend half of the class working on it like last time. Then towards the end since there wasn't a lot of class time left I started to work looking up if it was possible to create a timer in Greenfoot. From my research it seemed that theoretically it was possible but no one seemed to have been able to yet. This made me sort of disappointed since I wanted to create a way to create a high score in the game.

The You Lose Screen
----
-Moving the characters around to make the game hard + changing the speed to make the game fair
-How I plan to make the rock actors all move around differently.

Unfortunately, for me I was not able to get a lot of work done this Wednesday due to several computer problems. At first Greenfoot refused to start for a good 20 minutes. I shrugged this off since I wanted to get started and so I could finish up the game. Since most of the game was finished up I decided to start by making some unique asteroids. So I created a new subclass which spun around the bottum of the game. This was since I had discovered that if you stayed still at the bottom you wouldn't be hit by anything.


So after creating the spinning asteroids I started to play around with where the asteroids started (Look at the top picture to see it how it turned out). I was really happy with how everything worked out and how the game was actually kinda challenging. However, when this was done I realized that the internet wasn't working anymore. It was 2:30 and so I decided to go check it out. Unfortunately, for me it took a while to fix and by the end when everything was fixed, it had taken over a hour to get fixed.

Saturday, November 21, 2015

Finishing Things

Finishing Up My Game


Today I managed to finish up my game which unfortunately took a while longer than I hoped or expected. Fortunately it was only a minor hiccup and I was glad that it wasn't anything major. Today however, I feel like shaking up my blog posts a little bit by letting the pictures do the talking and explanation. I think that this is a good idea since it should make things easier to explain and also should hopefully show off what I have managed to achieve over these past sessions. 

This is how the game starts out at. All of the characters are in place with the main goal of the game being that you as a cross must destroy the ghosts before they eat most of the sheep. While the ghosts which are ai controlled just move around eating the sheep.

At first I had no problem programming in the "YouWin" (which you can see towards the bottom SW of the screen) which appears when the player has successfully gobbled up all 4 of the ghosts. Now while this code worked, the main problem arose when the time came to program in the "YouLose". For some reason the game didn't like it when you make the game end on another character other than the main one.

As you can see in the next 2 pictures, even though all of the sheep had been removed from the game, the game over screen didn't want to appear unfortunately.




For a while I couldn't figure it out but after tinkering a bit with the number of sheep required to get eaten I got a number(#16) which seemed to work. Fortunately, for me Mr. Shappell suggested that I change the code from an (=) sign to a more than sign (>). While this helped it didn't really work all that well. This is when I started to think that perhaps because there were 4 ghosts running around the game that it maybe screwed up with how the counting was working. This was a dilemma for me since I wanted the game to be a bit hard and that you couldn't win just by standing still. I played around with the numbers and I ended up with the perfect number which was 16. While it may not always end up actually working and presenting the "YouLose" screen, it presents it at 95% of the time and that works for me.



This is how the game ends after getting everything to work correctly. If the ghosts eat to many sheep its game over for the player.



------------------------------------------------------------------------------------------------------------

I started off in the next class feeling a bit down since even though I didn't mention it on the previous post I had decided to try out a new way of making Greenfoot's background. Unfortunately rotating and turning didn't actually work . With that failure in mind I managed through several ideas. At first I started trying to set a unique background but after a while I spotted the space background in Greenfoot. Seeing this, I decided to make a survival game that where objects were flying around in space. Once I realized this I spent most of the rest of the class setting up the actors in the game and made the actors moved. I enjoyed making this game and it went a lot faster than my previous game which shows to me how much more experienced I had gained in Greenfoot.


This is how my game looks like currently.

My two main actors

This is the main character of the game

This is the Meteor actor which is the enemy object you have to avoid. 





Friday, November 13, 2015

Finally Getting Things Done


          Making the Game Work

        Originally I first started adding classes and sub classes to the game and making sure that everything worked. Fortunately for me unlike last time I was able to finish up everything and have it run the moment I need it to run. Once I was done with the classes I put in the movement code for all of the actors. This code worked great and I had no major issues with the movement code besides one little issue where one of the actors when it hit the border of the map, would get stuck. Fortunately this wasn't that big of a deal and didn't happen again. Around this time I also realized that the pictures of the actors were a bit too big for what I was building and spent a bit of time to reduce and make them smaller since I thought that it was necessary if I wanted to make the game playable. In the end I was quite happy with the result but realized that I still had a long way to go before I was done.

The Game Currently

Today since it was a short lesson I decided to finish up as much as the game as I possibly could. The first thing I did was to add another ghost into the game since this would make the game be more balanced and harder for the main character. At first I was going to make it so that the cross would lose if it hit the ghosts but then after some thinking realized that the game would be a lot more funner if instead of doing all of that, I would just make the ghosts attack the ship (liked planned originally) and make the cross kill the devils. Now the goal of the game is to remove all of the ghosts to before they remove all of the goats. Before class had finished I had been able to change the code around to make the game work. Fortunately for me nothing went wrong and I managed to change the game completely and get the YouWin image to show up once you win as the cross. I really
 enjoyed the past 2 classes since I got a lot of work done and managed to nearly complete my game.


Here is how the game starts off with you being at the center and the game and the ghosts on all 4 sides. The game is relatively easy but on occasion you will lose.

Unfortunately I have yet to add an end game for when the ghosts eat all of the sheep. But considering all of the work and things that I have accomplished I was very happy with what I have done.

This is what the game looks like when you destroy all of the ghosts in the game. Really glad how easy it was to finish up this game and get things done.


Saturday, November 7, 2015

Failure Spawning Enemies and Freaky Friday


Today I decided that I would start to work on trying to spawn the demon onto the game after you ate a certain amount of sheep. Unfortunately for me this didn't work as planned and even though when I looked up several examples of how to spawn an actor, it just didn't work. I looked up several examples and in the end it just didn't work. It was super frustrating, I really was pissed that it just wouldn't work regardless of what I did. Eventually at the end of class I managed to finally found a YouTube video that showed me how to do it. Unfortunately, I didn't have enough time to work on the code since unfortunately it was the end of the class.

Example of the Code that Didn't Work
I feel that the reason that it didn't really work was because I was being a bit too arrogant with my code since I didn't end up following the code that I had researched perfectly. I feel that I under utilized this code and that wasn't correct. However that was not my only problem since I realized this when I was working with the code, was that I tried to use the code word to word. Unfortunately this also didn't work and left me more frustrated then anything else. Hopefully this last video that I have found will work because if it doesn't I'm going to give up on trying to spawn and actor. This will suck for me since I want to make the demon get summoned. However, if it doesn't work I will compromise and just start him on the map. The worst part for me however was not that it didn't just work, it was the fact that when ever I seemed close to actually being able to execute the error, hold and behold, an error would appear. It just drained my energy, made me frustrated and in the end I just had enough. When the next class came along I felt reinvigorated and desperately tried to do the code correctly that I had found the previous day. I did the code and yet again another error message popped up. That was the moment I had realized that on top of this the code I had just put up was a code to randomly spawn a actor in the beginning of the game, not in the middle of it. Finally I just gave up, it just wasn't worth the time that I had lost or worth continuing. I feel that the fact that this code didn't work was that I was a bit impatient with my research and the fact that there might just not be any code that does what I want in Greenfoot unfortunately. However there was one good thing that happened this week and that was that I was finally able to present my Freaky Friday presentation on Friday. It was fun and I hope that I was a bit entertaining, since I know that Refugees and Smartphones isn't always the funnest topic to watch or listen to. For me though the best part about Freaky Friday was that I was finally able to achieve something in this class after 2 very bad lessons I wish I could forget.