Author Archives: Travis

Guide to Building a Monkey-X Game to Android

Step 1: Import the project to Android Studio

You will need to import the project to Android Studio as a Eclipse project. File – New – Import Project and select the folder with your Monkey-X android build. This is usually ../appname/main.buildv86e/android_new although your main.build folder may be named differently depending on which version of Monkey you are compiling against.

Step 2: Rename the package

The default package name is “com.monkeycoder.monkeygame”. This must be renamed as that is already taken on the Play store.

You will need to rename this in the Android Manifest, the main Java file, the res – layout – main.xml file, and the gradle build script. In the Java file you will need to rename the package at the top as well as the ANDROID_APP_PACKAGE variable (constant?).

I also recommend renaming the application and activity labels in your AndroidManifest.xml file from “Monkey Game” to your games title.

Step 3: Create an Icon

You will need to bring in your own icon for the app. This needs to be brought into the “res” folder and then referenced from the AndroidManifest.xml file.

Simply do a File – New – Image Asset and select the file you want to import. Android studio will generate various resolution versions of it for you.

I believe you will want at least a 512×512 pixel image. It kills 2 birds with one stone because Android will use it for the icon and 512×512 is the resolution needed to upload your icon to the Play store page.

Step 4: Test it on an actual device

After doing these steps, sometimes you miss something and the app will crash. Make sure to test your Android Studio build on an actual device now.

Step 5: Create a Signed APK

You will need to create a Signed APK file to upload. Android Studio makes this pretty easy. If you don’t have a key or a keystore already, it will walk you through setting one up. Then use the key to create a Signed build of your game that will be used to publish.

Step 6: Fill out information on Google Play and Upload the Signed APK

You now need to go through all of the questions and info for the Google Play store. This includes uploading your icon as well as a feature image that at time of this writing is 1024×500 pixels. You can put whatever you want here but probably should make it related to your game. Additionally it asks for screenshots. Most phones can do this although it could be difficult with an action game, or you could do it with an emulator.

There is also an area to put a link to a youtube video if you want to cut a short promotional video for your game.

Other steps include filling out a content rating questionnaire, linking to a privacy policy, and setting up purchases and adds (to name a few).

Quick and Dirty

This is a brief overview of the whole process. Mostly just notes to myself with reminders about changing things in Android Studio for the next time I release a game like this.

Hope you find this helpful.

First Monkey-X Game: The Boss Shoots Back

The basic structure for our game is there, we need to start to make it more interesting now. Our Boss could use some work. All he does right now is move up and down.

Not exactly Boss like.

The Boss Shoots

Step 1 in making the game more interesting is having the Boss on every level actually shoot at the player.

This is actually pretty simple because of the work we did creating the character and projectile classes and their methods.

Boss Bullets Hurt

Now that the Boss is shooting, we need to make sure that projectiles that hit the player follow the same kind of rules that the player’s projectiles do. When they hit the player, they should damage the character and then disappear.

This means adding a little more logic to our CustomeEngine’s OnObjectCollision method.

Now when you play the game, if the player character gets hit by one of the Boss’ projectiles, it should get damaged and the projectile should disappear.

Extra Projectiles for the Boss

It seems like the Boss should be a little more powerful. Shooting one bullet at a time seems a little weak. So we are going to have our Boss shoot 3 bullets at once. That should make it feel a little more challenging.

To do this, we are going to slightly modify our CreateProjectile method to take a width and height offset from the character that is shooting. This will also come in handy later when we want to add powerups.

Your Boss should now be a worthy opponent firing 3 bullets at once.

Time for a Theme

All of our hard work is starting to pay off. We now have a framework for setting up levels with a Big Bad Boss at the end of each one that can move and shoot at the player.

Next we will start adding some images to the game to give it a theme.

Essential Planning for 2017

It often seems like we don’t have the time to pause and lay out a plan. But I have found this to be super valuable. It is time well spent and actually reduces the time it takes to get to your goals.

A 12 Week Plan

One of books that I read/listened to last year was called the 12 week year and described a method to essentially get a year’s worth of work done in 12 weeks.

I don’t know if this is entirely possible, but I did find that having a set of goals for the whole year was not ideal. Also, writing a post to review them every month was probably not a best use of writing time. Twelve weeks seems like a pretty good number for a set of goals and then reviewing them afterwards.

Major Goals

Part of the 12 week year planning process is setting a larger goal that is to be reached in about 3 years. This is the vision of what you want your life to be like in 3 years.

You then set smaller goals to be accomplished in the next 12 weeks that will move you closer to the 3 year vision. These goals should be a little bit of a stretch for you. They should not be impossible, but also not super easy.

Finally you breakdown the actions you are going to take each week to accomplish your 12 week goal.

Applying the Process

I have decided to give this planning method a try in the first quarter of 2017 to see how I like it. The vision part is a mix of personal and business goals so I will not be sharing that here, but I will be tracking my 12 week goals.

Goals for the 12 Weeks

You should probably have no more than 3 major goals for each 12 week stretch. Otherwise you will not be focused and probably won’t come close to any of them.

My goals for the next 12 weeks are:

  1. Finish the Making Your First Game with Monkey-X tutorial series and turn it into a short E-book: Although the Monkey community is not all that large, it is a great little framework and perfect for beginners. I am still learning a lot writing this tutorial although I have decided to switch target frameworks as a specialty.
  2. Clean up and release Prism Ship to Android with 2 versions, 1 paid with no ads and 1 free with ads. This will be hooked up to Google’s service that tracks high score: I really liked getting a game out to Android last year and I want one that could start a small revenue stream. Not looking to make tons of money with this, but I already have the code and want more practice with releasing things to Android.
  3. Begin specializing in Xamarin: one of the key concepts I learned last year was the importance of specialization. It is tough. There are so many cool things to learn. But if I want to actually achieve success, I will need to start by focusing on a niche. One of the reasons I like Monkey is because it allows cross platform deploys. Xamarin does the same thing for cross platform mobile app development. The overall focus will be on doing cross platform development and deployments. I will still be making games, just not writing about it as much in the first quarter. Additionally if I don’t like Xamarin at all after 3 months, I will pick something different.

So lots of changes coming up, but ultimately a clearer focus. Looking forward to an awesome 2017.

First Monkey-X Game: Final Boss and Game State for Winning

The game is getting pretty playable, but like all good things it needs to come to an end.

If you remember from our little design exercise, we have a goal that will end the game. When we defeat the Big Bad Boss.

In this step, we will add the Boss into the game and create a Game Won state for when the player defeats the Boss.

Getting to the Big Bad Boss

The boss is going to be another character that we add to the game. We want him to be tougher than any of our enemies so far and we want him to shoot at the player to make it challenging.

Let’s start by creating the Boss character.

So now we have a field where we can put our Boss and we have a method that we can call to create him, but we don’t want to call it right away because we only want to have our Boss show up when we get far enough into the game.

So we will need 2 more things. First we need something to track whether or not it is time for the Boss to show up, and once this tracker is satisfied we don’t want to create another Boss.

Ok, at this point when you run your game, if you survive for 15 seconds or so you should get to a point where the small enemies stop getting created and you see a large purple shaded box representing the boss.

Boss Behavior

Now that we can get to the Boss, we want an EPIC BOSS FIGHT! Ok, maybe it won’t exactly be epic at first, but we can start by giving him some basic behavior. We also need to add the ability to shoot the Boss.

To start with we want to add some simple AI to the Boss’ movement. Nothing fancy, just moving the Boss up and down.

Now your Boss should go up and down the screen. Really, really simple pattern for now. We can get fancy and create more complicated logic for the movement later.

Damaging the Boss

Now that the Boss is moving, we need to be able to destroy it so we can win the game. This means we need to wire up the collision detection for our player’s projectiles and the Boss hit box. We also need to make sure the Boss takes damage when it gets hit.

Now projectiles will collide with the Boss but our current Character code won’t handle this correctly after the Boss gets hit. So we need to make a few tweaks to the Character class.

Now you will need to go into your main Game class and update the constructors for your Player and the Final Boss. The regular enemy constructor is fine since it just uses the default. There is also a check when firing projectiles that needs updating.

Now your projectiles should hit the Boss and damage it. However you should notice that once the Boss’ health drops to 0, the Boss is still there and the projectiles just fly past.

We still need to make the OnUpdate method a little smarter about what happens when the Final Boss is destroyed.

Destroying the Boss and Next Level

Destroying the Final Boss is simple enough. In the OnUpdate code, simply add a check to remove the Boss from the game when his health reaches 0. But what we really want to do is change scenes to a show that we beat the boss.

In order to give us some room to give the game more depth, we are not actually going to have the player win the game after beating the first boss. Instead we are going to have the game transition to a Next Level scene.

Now we have a scene we can transition to, lets transition to it when our Boss dies.

And we don’t want to get stuck there so lets add a method to allow the player to continue.

Now when you play the game, after you destroy the Final Boss, you should get to the Next Level scene. Then if you hit enter it should start play again but your score will remain the same.

Actually Winning

What we really want to do in this chapter is give the player the ability to beat the game. In order to do that we need to add 1 more scene, the Game Won scene.

If you have been following along, you have already gotten pretty familiar with adding scenes to the game by now, and could probably do this yourself. Just in case here is the code for the Game Won scene.

Now we need to be able to actually get to this scene. Defeating the Boss doesn’t get us there, it only gets us to the next level, and right now we have infinite levels.

First let’s put a way to track what level we are on and set a maximum number of level. Then we can use those 2 values to tell us when to end the game.

Now whenever we get to the Next Level, lets update our current level and see if it is the final level.

Now when the player beats the boss on the last level, they have beat the game.

In the next section we will make the Boss a little tougher and let him shoot back.

How’d I do? Full Review of 2016

Its 2017. A new year and a new set of goals.

But one of the things I learned in 2016 is the importance of occasional reflection and evaluation. So before setting some new goals for myself with this blog and with making games, I am going to reflect a little on this past year’s goals and how I did.

Writing

Goal: Write 3 posts per week and publish 2 to build a small buffer of unwritten posts. This would have been 156 posts written and 104 published.

Actual: 70 posts written and published.

What’s great about this? Even though I did not hit my goal, in fact I came in just under half of the writing goal, I almost tripled my volume from 2015 (only wrote 26 posts that year). This is fantastic!

Games

Goal: Make one game per quarter (every 3 months) and release each of those games on the Play Store for Android. So 4 games and all released.

Actual: 2 Games finished, 1 about 50% of the way, and 1 idea kind of left to die. Only 1 of the 2 finished games was published to the Play store.

What’s great about this? This is the first time I have released a game on Android. I can now point people to my game or show it to them from my own phone. I learned a ton turning it into a multiplayer game and releasing for Android that can help me out in the future. In fact I am probably going to go back and release at least one of my games from 2015 to Android.

Reading

Goal: Original goal was 1 book on game design every 6 months, which I modified to 1 per quarter. So 4 books on game creation or game design for the year. Also read 1 article on game design or watch 1 video on it every week.

Actual: I read 3 books specifically related to making games and game design and several that were helpful, such as Clean Code. Not only that but I read over 25 books total last year. For the articles and videos, I did not keep track of them like I should have, but I read way more than 52 articles and watched quite a few videos and interviews on the subject. One of the goals I exceeded greatly.

What’s great about this? I learned a ton this year about making games, game patterns, game types, and different parts of the game making team. And I found so many more books to read for 2017.

Audience

Goal: Roughly 100 unique visitors a month by the end of 2016.

Actual: More like 30 or 40 although I had a couple months where it was more than 100. I switched analytics trackers in December so I lost some history, but this is to give me better information in the future.

What’s great about this? I actually started telling people about my blog and sharing some of my posts. This is way better than last year where I am not sure that more than 5 people visited my blog the whole year. Also, I actually hit my goal a couple of months.

Important Lessons

Written goals are super valuable. And they are even more valuable if you review them periodically.

Simply having the goal of getting 100 people to view my blog every month would not have been enough if I had not taken a measure every so often to see how I was doing and to remind myself to do something about it.

It also helps you see when your focus is on one of the goals and the others are suffering because of it.

Bigger goals are better because you are going to fail anyway.

One of the important things I learned this year from reading the 10X Rule by Grant Cardone is that most people fail at their goals. Only meaning that they don’t hit 100% completion on them.

So do you want to fail at a small goal or a big goal. If you are only going to get 50% of the way to your goal, you want a bigger goal. Because 50% of 100 is 50, but 50% of 1000 is 500.

I really felt this with writing especially. Upping my writing goal, even though I did not hit it, significantly increased my writing volume.

Overall 2016 was a huge improvement and I am looking forward to making more progress in 2017.

First Monkey-X Game: Restarting the Game

Now that the player can get to a game over state, we need to let them restart the game without having to refresh the web page.

Hit ENTER

We will add a new check for after the player has been destroyed for the ENTER key to be pressed to try again. Also we will add a message in the game over screen to tell players what they need to do.

Let’s start by adding the instructions to the Game Over screen on how to restart.

Now we want a way to reset the game whenever ENTER is pressed from the Game Over scene. We will do this by creating a small method in our game that goes through and deletes all of our enemies and bullets and recreates the Player.

You will notice that we have a new method here called CreatePlayer. Our next step is to refactor the code from our OnCreate method into this method so we can recreate our player when we reset the game.

The final step is to add the code to call the GameReset method when the ENTER key is pressed from the Game Over state. This will make its home in the Game’s OnUpdate method.

And now our player can easily start over when their little character gets destroyed.

Our next step will be creating a boss character and an end state to our game.

Books I Read in 2016

I love reading. So much so that I read over 20 books this year.
This is a brief breakdown of most of the books I read.

Game Design and Game Creation Books

Since I am teaching myself game design, I started reading books related to getting better at making games. There are several more in this category that I plan on reading for 2017.

The Art of Game Design: A Book of Lenses – Jesse Schell

This was the main book I found when Googled which books to read about game design. It is an awesome book covering game design pretty thoroughly. It is a long read and full of great information. I would definitely recommend anyone who is making games or thinking about making games give this a read.

Game Programming Patterns – Robert Nystrom

This is a free to read online book (you can purchase print and e-book formats) that covers various patterns that you find in games and game engines. Even if you are using an engine that takes care of most of this stuff for you, it is still worth a read to learn about what is going on behind the scenes.

Making Games with PhaserJS – Thomas Palef

I mainly read this book to get some ideas on the format of a book teaching people how to make a game. One of the most useful ideas I got from reading it was to look into the engines and plugins that were made for Monkey-X that handled physics and other things I had been calculating before. It is what led to me looking into FantomEngine. A really good read and a good tutorial for learning the PhaserJS game framework.

General Programming Books

My daytime profession is being a programmer and the games I make are primarily video games. It follows that getting better at programming would greatly benefit me.

Clean Code: A Handbook of Agile Software Craftmanship – Robert Martin

One of the most influential books that I read this year. It really helped me be more mindful about the way I made my games and wrote the code to make it easier to come back to. The difference in the way I wrote and looked at code before I read this and after is huge. Anyone who is going to write code to make a game should read this book. I will probably read it again in 2017 as a refresher.

Agile Web Development with Rails 4 – Sam Ruby, Dave Thomas, DHH

In teaching myself Ruby on Rails this year, I went through this book and did the exercises in it. It is an okay guide to the Rails framework and a pretty solid foundation for a beginner.

Books on Productivity

If you can figure out how to create more value in an hour than anyone else, you can probably rise to the top and write your own ticket.

Linchpin – Seth Godin

A pretty good book about being the kind of person that is really valuable to a company. Can strongly recommend.

The 10X Rule – Grant Cardone

Basic message is make your goals bigger and push harder for them if you want to achieve success that others can only dream about. Inspiring. Definitely worth the read.

The War of Art: Break Through the Blocks and Win Your Inner Creative Battle – Steven Pressfield

I wrote about some of the ideas that I had heard from this book, then I actually read it. Strange order I know. The author primarily warns you about Resistance and encourages you to fight through it and not let it stop you.

Do the Work – Steven Pressfield

Written by the same guy who wrote The War of Art, this is a short book that kind of walks you through a project and gives you warnings and tips about how to finish a project. I especially like what it says at the end. Ship your project, then start a new one. Liked this a little better than the Wart of Art.

The 12 Week Year – Brian Moran

Basically saying you should set 12 weeks worth of goals at a time, not 12 months although they might be the same size goals. One of the reasons I picked this up was because I noticed that my goals were morphing and evolving over the year as I learned and got more information. The plan in this book is ok and I am going to start 2017 by trying it out.

Action Strategies for Personal Achievement – Brian Tracy

This is not a book. It is a course that you can get on Audible and it is pretty long. There is a ton of good information in this course. Definitely recommend getting it and listening to it. I am currently listening to it again because it has so much good stuff in it.

Finance and Business Books

We all deal with money, almost on a daily basis. It would benefit everyone to master this particular area. Also, understanding business will help you understand money.

Money Master the Game – Tony Robbins

Book about how to invest using the strategies of the super wealthy. Covers proper mindset about money and then tells you how even low income people can invest to have a good retirement. Definitely worth a read if you invest in the stock market or have a 401K or IRA.

The E-Myth Revisited – Michael Gerber

Awesome book. Really powerful look at small businesses and entrepreneurs and why they fail. Thankfully it also includes how to do it right. The key is systems. Will be reviewing this book again in 2017 as well. Must read for anyone starting a business for the first time.

Never Split the Difference – Chris Voss

This book is about the art of negotiating effectively. The author takes skills he learned as a hostage negotiator for the FBI and applies it to business and life in general. Super powerful book. Will be keeping it handy.

Millionaire Real Estate Investor – Gay Keller

I bought my first home this year and I am looking into doing real estate investment. This book was recommended by someone I know who has invested successfully in real estate as the only book he would recommend. It has good, actionable strategies and plans for investing in real estate. Definitely pick this up if you are planning on doing any real estate investment.

Rich Dad, Poor Dad – Robert Kiyosaki

This book is primarily about having the correct money mindset. Getting rid of the limiting and disempowering beliefs you might be holding about money and replacing them with stronger beliefs and understanding. Great read.

Self Improvement Books

One of the things I picked up near the beginning of the year was that if you work on your job you can make a living, but if you work on yourself you can make a fortune. To that end I read several books and listened to several courses and talks to work on myself.

Outwitting the Devil – Napoleon Hill

I listened to this on Audible on a recommendation and I can recommend this format as well. The voice actor for the Devil character does a superb job. The format is an interview with the Devil who tells his secrets for keeping people from being productive and living good lives. This was written by the same guy who wrote Think and Grow Rich (which you should also read).

How to Win Friends and Influence People – Dale Carnegie

Powerful book on how to interact with people in a way that you both come out of the interaction feeling positive. Good warnings on common missteps and great advice on how to form better relationships. I read this 3 times this year. I will be rereading it next year.

Re-Awaken the Gian Within – Tony Robbins

Pretty good book about creating lasting change and how to get what you really want out of life. Would recommend reading. You can get it for free. I may reread it soon.

7 Habits of Highly Effective People – Stephen Covey

Classic book on self development and self improvement, and I now know why. Stuffed with value, you should definitely find yourself a copy of this book. One of the most interesting ideas for me that the author puts a name to is the Emotional Bank Account. It spells out a phenomenon I have seen occur all the time with regards to various relationships.

The Power of Now – Eckhart Tolle

Weird book. Has some good ideas in it such as not letting past and future events give you anxiety. Had some trouble following the written style, I imagine it would be easier to listen to. Some of the stuff in it is kind of mystical sounding. Not a strong recommendation on this one, but there is value here.

Good to Great – Jim Collins

Another classic book on self improvement. Comes up with various principles on what it takes to become great and then gives case studies. A solid read.

Man’s Search for Meaning – Victor Frankl

An interesting little book written by a Jewish Psychologist (Psychiatrist?) who survived the Holocaust and being worked to the bone in a concentration camp. Some good points on the meaning of life.

As a Man Thinketh – James Allen

More of a pamphlet than a book. This short read is still super valuable. You can find it for free on Project Gutenburg. Wholeheartedly recommend.

Fiction

Although a lot of my reading this year was focused on making games, self improvement and business, I still found some time for a few good fiction books.

Atlas Shrugged – Ayn Rand

Huge book. One of the thickest on my bookshelf. It is also thick with a great story and a great point. Super enjoyed this book and the underlying message. 100% recommend reading it although I would recommend getting the Kindle version for portability.

Catch 22 – Joseph Heller

I had heard this phrase growing up and wanted to learn about its source. This book was a ridiculous story and very entertaining. The author has a way with wording sentences that was fun and may help you increase your vocabulary. Can definitely recommend this as a entertaining read.

Other

Evolution 2.0 – Perry Marshall

An look at evolution from an communications engineer perspective. Very thought provoking and well written. Definitely recommend this to anyone who is on either side of the evolution/creation debate as a valuable perspective.

The Reading List Is Growing

I already have more books than this that I want to read in 2017, not to mention the ones in this list that I want to reread. We’ll see how far along I get.

First Monkey-X Game: Player Destruction and Game State for Losing

Our player can fire projectiles and destroy enemies. He can run into enemies and take damage. But right now the player does not get destroyed.

In this part of the tutorial, we will move to a Game Over state whenever the player gets destroyed. This will cover some of the basics of FantomEngine’s layers and scenes.

Game Over State

Right now, we only have the default layer and scene which we are playing our game in.

In order to be able to move to a Game Over state, we need to create a new scene that the game can transition too.

Now we have a play scene that we will run the game in, and a game over scene that we will show when the player gets destroyed.

Right now the game over scene doesn’t have anything in it. In the game’s OnCreate method, we will build our game over scene by adding some text that says “GAME OVER”.

It is important to remember with FantomEngine that whatever layer is the current default layer will be the one that things get added to. This is why we need to change the default layer to the game over layer when adding the Text object and switch back when we are done.

NOTE: The font system is not particularly well documented for FantomEngine. It supports FontMachine and EZGui style fonts. You will need a PNG file and a TXT file describing the layout in your project_name.data folder for it to work. I was able to use a tool called Hiero to convert Google font VT323 to this format. There will be an appendix section covering this. There is a sample font in the examples that come with FantomEngine which you can use in the meantime. I will also try to make the converted font I did available.

Switching Scenes

Our final step will be to add a check to the OnUpdate method to switch the scenes if the player is destroyed.

And now we have a playable and basic version of our game where the player can move, shoot enemies, and be destroyed which ends the game.

First Monkey-X Game: Projectiles and Score

We have all sorts of enemies flying at our hero and if he hits them they disappear. Now we need to incentivize him to NOT run into all the bad guys.

Our next steps are to make enemies damage our hero when he runs into them, give him the ability to shoot the enemies before they reach him, and give the player points whenever they successfully destroy an enemy.

Health

Since all of our enemies and our player are Characters in our game, we can handle keeping track of their health in our Character class.

To do so we will add a health field and give each enemy and the player some starting health and a maximum amount of health.

Now we need to change our game creation code and our enemy generator to pass in health for our player and enemies.

Damage

Now that characters have health, we should give them the ability to take damage.

Let’s change the OnObjectCollisionMethod to cause the player and enemies to damage each other when they run into each other.

In our character class we are going to add a method that handles units taking damage. Then we will call it from the character Update method.

And in our OnUpdate method, we will make some changes to handle updating characters to damage them and destroy them.

Now when you run the game, when the player runs into an enemy it causes damage instead of outright destroying them. Enemies with more than 1 health won’t be destroyed. And after the player takes too much damage, they will no longer damage enemies. Eventually we will add a GAME OVER or lost life for this case but that will come later.

Projectiles

Now that we have characters taking damage, lets give our player the ability to shoot at enemies and destroy them. We will start by making a projectile class and a projectile type class. Create a new file called projectile.monkey that we can start making projectiles from. It will have a constructor and an update method.

and a file called projectile_type.monkey

Projectiles have a variety of attributes. First of all they have a box that can collide with enemies, and when we make enemies that shoot, with the player. Next they have power. This is done so that powerups can make the player’s projectiles stronger.

We also give the projectiles maximum speed, range, and acceleration. This is also for handling upgrades and how different weapons on different player ships or characters will work. We can have a short range, fast moving projectile. We can have a long range projectile that starts slow but speeds up over time which we handle with the Projectile’s Update method. Whatever we want.

The reason we separate the projectile type attributes out is so that we can store each character’s projectile type in their character class.

Firing

Now we want our player to be able to make some kind of projectile when the space bar is pressed. We are going to give the player character a type of projectile to fire and limit their fire rate. The idea is that whenever the fire key or button is pressed, we will true to the game engine and it will create a new projectile at the player’s location.

First we need to pass in a ProjectileType as part of the Character class constructor.

And modify the Character class to have a ProjectileType

Now we are going to add a projectile creation function for our game, and set up the SPACE bar to be our firing control.

You should be able to “fire” bullets now. Currently we are not restricting how fast you can fire, which means you can use bullets to draw a line on the screen. Our next step is to limit the players fire rate. We will do that by giving characters a last fired time as well as giving projectile types a rate of fire.

Start by updating the ProjectileType class.

Then in the Character class, lets add a method that determines whether or not a character can fire.

Finally, add the check for whether the player character can fire or not in our games OnUpdate method. Also we are going to make some small modifications to the CreateProjectile method

Your player’s character should now be firing little light blue bullets about every half second if they hold down the space bar.

Projectile Collision and Damage

Now that we can fire projectiles, we want them to actually hit the enemies and do damage to them. This means we need to modify our CustomEngine Class OnObjectCollision method to tell enemies to be damaged by projectiles and to set projectiles to destroyed when they hit enemies. While we do that, we will also refactor our other collision code to make it cleaner.

We also need to remove all projectiles that hit enemies from the game, so they don’t hit enemies twice. And since we are not currently calling the projectile’s Update method each loop, acceleration will not work yet. Let’s add that in as well as we loop over the projectiles.

When you run the game now, bullets that hit enemies should disappear and enemies that take enough damage should be destroyed (at this point red enemies take 1 damage, green take 2, and blue ones take 3).

Score

For the final part of this section, we are going to give the player points whenever he destroys an enemy. To do this we need to assign each enemy a point value, we don’t want those tougher enemies to be worth the same as the weak ones.

To do this, we are going to store a point value in the Character class. The player character won’t use it and that is just fine. We will also make a method for increasing the points earned. Then whenever an enemy with 0 health is destroyed we will give the player that many points. The reason we are checking the health is that soon we will be removing enemies that fly off the screen to keep game performance up.

Now we need to modify the Enemy and player creation code to include point values in the constructors.

Now lets add a check in OnUpdate when we destroy an Enemy to increase the player’s score if the enemy’s health is 0 or less.

Now whenever we destroy and enemy, our players score will get updated. But we can’t see what the score is right now. Our next step will be to draw the player’s score on the screen. We will do that my adding a text draw to our OnRender method to draw the player’s score in the upper left hand corner of the screen.

That wraps up projectiles and scoring for now. Our next step is to be able to actually end the game when the player takes too much damage and to add some other game states.

Tutorial Part 7

November 2016 Goal Review

Time to review November before it gets too far away.

Goals

  1. Write 3 Blog Posts Per Week and Publish 2 – Only 4 written in November. My main focus in November was not so much on writing but on my next goal.
  2. 1 Game Designed, Created, and Released Per Quarter – This was the primary focus in November. I spent a good deal of time stabilizing the multiplayer server code for the game then on creating a build of it out on Heroku so that the web and eventually Android clients can play multiplayer on it. I was able to release the game out on Itch.io in November, and at the time of this review, it is also on the Google Play store for Android (although that was done in December).
  3. 1 Book Read Every 2 Months on Game Design – Still reading through the online version of Game Programming Patterns. Haven’t made a lot of progress through it because I have several other books that I am reading through. I usually have 3-5 books that I read through at once and usually only 1 of those is game related.
  4. 1 Article Read Or 1 Video Watched About Game Design/Creation Per Week – Again I watched a few more Extra Credits videos that came out in November and I have been reading the API reference for the Monkey-X FantomX engine. Refocusing on this a bit in December. However, I did go to a local game dev meetup in my area and followed along a bit with a Unity tutorial that was being taught. I also met some awesome guys who are making games in my area. I would strongly encourage everyone to do this. One of the guys told me a bout a game he was working on where you play through sound. It was pretty cool, you can check it out on GameJolt
  5. Get 100 People Reading Evolving Developer Per Month – Honestly have no idea how I did in November. I just switched analytics from Clicky which was fine and fairly lightweight, to Google analytics so I lost any history I had and Clicky’s free account only gave you like 30 days history anyway. But now I will have a little more insight and history as I go forward.

What Went Right

Game #2 was finally released to where people can play it. It is stable and multiplayer works through Heroku. I was able to write some good tutorial steps that I will turn into chapters of a book on making and releasing your first game using Monkey-X. And I met some awesome people in my area by going to a local meetup.

What Is Not Perfect Yet

I think this has mostly been a theme for the year, writing volume not at intended level. Looks even lower than average because I forgot to do the October review until December. Also I need to start documenting the things I watch and read so I can better track my progress. Finally, I need to work on solving more people’s problems because that is how to increase traffic.

Corrective Measures

I have gotten my sleep schedule back to pretty regular and have been doing more writing and programming as a result. Working on building a habit of writing down immediately when I watch or read something relevant to game creation. For helping more people, I need to start looking for problems to solve. This means reading blogs, forums and QA sites to find problems to solve and write about.

Gonna try a new goal pattern in 2017, stay tuned.