Thursday, May 2, 2013

Finished my first game!

Hey all! I finally got a few hours to work on Bomb Catcher and I finished it. Well, I think I might add to it but the first version is done. I think it turned out well and I have had fun playing it. Here is the link to my public Dropbox with the folder inside: Bomb Catcher

Controls:
There are three controls.
Left arrow(or "a" key) = moves cart left
Right arrow(or "d" key) = moves cart right
Space bar = speeds up cart

I hope you guys and gals try it out. Any criticism is great and I can post all the code if anyone is interested.
**I have notice on some computers the lighting does not work or seems not to work. Does anyone know why this could be? Thanks

Example of the lighting problem.


Now for some information and problems I ran into finishing up the game, there were a few. First, I had trouble importing the cart I made to Unity. Secondly, I had to learn how to save data in one scene and then use it in another. Lastly, I had trouble using data from other scripts.

Importing My Model
I created my cart model in Google Sketchup. Now, I understand this is not the best program to use to model but when I was in High School I used to make things in it all the time so I knew how to use the program. I wanted to get out my first game soon so I did not want to take the time to learn how to use another 3D drawing program. I finished the model and tried to export it and I ran into a problem doing that. Unity likes FBX files so I had to find a converter that converts Sketchup files to FBX files. I used one from Autodesk(I do not remember exactly). It worked and I got my model into Unity. But when I attached my movement script to the object it was not moving how I wanted. I realized the model's axis were different then Unity. I looked online to find a solution and ended up using a empty GameObject and made it the parent to my model. I attached the movement script to the GameObject and my problem was fixed.

Accessing Variables from other Scripts
I have a couple if-statements that I had checking certain variables to trigger events. For example, i was monitoring the number of lives the player has. To do this I needed to access the variable from another script. I had no idea how to do this. Well I knew I could use static variables but I have read to try to avoid those. So I went to the Unity3D subreddit and I asked. I had some answers within a few minutes. I was sent to a website called Unity Gems. They have tons of tips for beginners and answers to common questions. Reading through I found the solution to my problem.

Saving Data From Scene to Scene
This problem came about when I tried to show the players score after they died. I change scenes when the player loses all 10 lives. So I created another empty GameObject and I added it to the scene. Looking through the Unity Script references I found a command that tells the object to not be destroyed. So using the information I learned from accessing data from other scripts, I save the player's score when they die. I do not destroy the object. When the new scene loads I access the script and display the final score to the player. It took me sometime to finally get it to work but I learned a lot in the process.

Here are the links to my reddit post and the Unity Gems website
My reddit post
Unity Gems

-Dan

3 comments:

  1. From http://www.reddit.com/r/Unity3D/comments/1dhmrv/finished_my_first_game/

    In your dropbox account, put this in your public folder. Then click next to the name (not on it) and choose 'copy public url' for the HTML file. Then change https to http and people can play directly from your dropbox, instead of having to download it.
    Congrats on finishing your first game! You should post a screenshot or 2 to entice people into trying it. (name_was_taken is the reddit user)

    Mind trying that so I can give it a play easily? Thanks.

    ReplyDelete
  2. Okay I believe I fixed it! Thank you.

    ReplyDelete
  3. Few thoughts:

    A menu would be good practice for you probably. New Game, Difficulty (Easy, Medium, Expert) which can just control speed of the cannon for simplicity sake. The score records your highest score during the current session and not necessarily the score on your latest run. Adding some explosions to the bombs would also be a nice tough. If you want to get crazy add the texture for some tracks and a hand crank along the side that represents the back and forth of cranking it to make the cart move. All little touches that vastly improve the visual presentation. It's a great start and I hope you continue to polish it.

    ReplyDelete