Author Archives: waywardson07

About waywardson07

I am a Computer Science student looking to connect with others that have the same interests as I do.

Too Many Eggs

Hi everyone! For this blog post I’m going to be linking to an app I just released on the app store. The name of the app is… you guessed it.. Too Many Eggs.

I got the idea for this app while watching a youtube video of an old NES game with similar gameplay. I thought it looked like a fair amount of fun and decided I was going to build an app like it. I also set another challenge for myself… I would have to finish the app in THREE DAYS!!. So I got straight to work coding the thing, and I ended up using A LOT of code I had already written for other projects I have worked on in the past. The functionality of the game was mostly done on the first day, but it was the graphics that I was really worried about. You see, I like many other programmers, am a terrible artist. As a way of getting around this, I decided to have as much of the graphics as i could drawn in code and everything else I whipped up in photoshop. The end result turned out quite acceptable.

I have posted the info for the app below: (by the way.. I met the three day deadline =] )

Too Many Eggs

iPad_Air_2_V_Slvr_iPhone_6_V_Slvr_sRGB_1014

Get it on the App Store

What are you waiting for! Download it and let me know what you think!

iPod Touch 4 White Screen of Death Fix

ipod_touch_4

Hey everyone!!! It’s been a little while since I’ve written here but I’m back! For this post I want to talk about a problem I ran into this week working on an iPod Touch 4th gen. I was replacing the LCD on an iPod touch 4th gen. when i ran into the dreaded “White Screen of Death” (pictured below).

white screen of death !!!!

The problem goes like this.. I’m replacing the cracked LCD on the iPod, then when I connect the new LCD and try to test it, the screen is just completely white.

Naturally I panicked! I looked all over google trying to find a solution. Most people were able to solve their problem by a simple hard reset, holding the lock and power button for 10 or so seconds, but it wasn’t working for me.

When I had just about given up, I ended up finding a video on youtube that displayed the exact same problem as me. The video explained that this could be caused by a small, and I mean SMALL!!!!, resistor near the LCD ribbon cable connector.

Apparently the resistor was knocked off at some point during the repair and now I was going to need to create a jumper across the two pads that the resistor used to reside on.

Here is a link to the video btw: https://www.youtube.com/watch?v=AkidFMCNKK4

Of course the video is great and all for pointing out the problem, but I noticed that a lot of people were confused about where to drop the dab of solder. Soooo… I felt compelled to post this article as a public service to anyone else who found themselves stuck with this problem.

iPod touch 4 motherboard

Above we have a photo of the iPod touch 4 motherboard zoomed in at the area where the lcd plugs into the board. (this is a spare parts board i had laying around)

In the photo below I have painted in the traces that lead to and from the resistor that was knocked off. The two red dots on the left hand side of the photo are the pads that the resistor was once soldered between.

paintedTraces1

In the next picture below, I have added yellow lines representing two ways of fixing the problem.

paintedTraces2

You could either drop a dab of solder between the two red dots on the left, and that would be enough, or you could use a piece of wire to connect the red dot in the upper right to either P2 or P4, and that would also solve the problem.

I decided to go with the first method and just drop a dab of solder between the two pads on the left, but this may not be the best option for everyone as these two pads are SUPER SMALL!! and it requires a lot of patience and skill to do. Heck, even putting the wire between the right dot and P2 or 4 is hard!!! But if you’re good with a soldering iron and have a lot of time to waste, then you could get this problem knocked out without growing too many white hairs.

Below is a photo of the dab of solder dropped into place as well as another photo showing the actual iPod i repaired with the missing resistor.

solder

paintedTraces4

Well, thats all folks!! Hope you enjoyed this blog post, and I hope it helps a lot of you out there!
As usual, If you found this information useful please leave me some comments, subscribe, or if you’re feeling extra generous, you could always click that donate button up top.

Byte-Font Designer

Recently I was playing around with an LED Matrix and a PIC microcontroller. I wanted to scroll some text across the matrix, but I ran into a problem when it came time to pick a font. The problem was.. well.. I couldn’t find a font to use with the matrix anywhere.

The next best thing I tried was finding a font creator…(which I did)… however, the font generator that I did find didn’t quite cut it for me. There was too much copy, paste, and editing I had to do in order to get it to work properly with the programming language I was using.

My final solution was to make my own font creator application and make it a lot more versatile than the ones I had found.

Enter “Byte-Font Designer”

Byte-Font Designer

Byte-Font Designer has an 8×8 grid of blocks that are initially set to a tan color. clicking on any of the blocks changes its state from a “0”(tan) to a “1”(green) and vise versa.

Once you have drawn the shape you want, click the big “ADD” button and your shape will be displayed in the output box. Your are given the option of representing your shape as a binary, hex, or decimal comma separated list. Each time you click the “ADD” button, the new shape will be added just below the previous one in the output box. Once you’re done you could copy the entire thing into your project with ease.

The feature that makes this application so versatile is the option to add prefixes and suffixes to your output. For example: If you had a byte such as this one “00000000” and you  wanted to use this app to display it in a way MPLAB IDE could recognize, you would add ” b’ ” in the prefix box, and ” ‘ ” in the suffix box and the output would look like this ” b’00000000’ “. I found this feature to be very useful when creating fonts, and it saved me a load of time!!

The rest of the features are pretty self explanatory so I won’t be mentioning them here.

Update: I created a Mac version of the software in response to a request made on another website.

Here is a screenshot:

Screen Shot 2014-04-19 at 12.52.17 PM

Both versions of the program are available from the downloads page: Downloads

2D Platform Game IOS Port – Part 2

Welcome back. If you haven’t read the first part of this blog post please check it out here. Otherwise, you can download the project source from the Downloads page.

Last time I showed you how to create a new tile map for the 2D Platform Game I posted, but we didn’t get into any of the details on how the project actually works. I said that I made a few changes from the original source code written by Paul over at http://www.wildbunny.co.uk, and now were going to dig right into them.

Class Hierarchy

Code Structure

Code Structure

The class hierarchy for the game is identical to the original source.

hierarchy chart

hierarchy chart

The Player inherits from the character and the character inherits from the Moveable Object.

The Moveable Object class contains all of the generic collision detection code required for an object to interact with the world.If you wanted to create a new “character” in the game, such as an enemy, you would subclass the character class just like the player class does.

These three classes are what make this game work, but they require that we pass in a Map object during initialization.

The Map Class

The Map class is simple enough, it accepts a .tmx tile map during initialization, and aside from being passed as an object to the characters of the game, should not be touched.

The job of the map class is displaying the layers of the .tmx tile map, and giving key information about tile locations and types to the moveable object hierarchy. As you further develop this project, you will be able to add more tile types to the map class.

Player Input

The main problem porting the code from the original action script to objective-c was player input. Since we are working with a mobile device with touch input, wer’e not able to read inputs as they were before. In order to solve this problem, I had to implement two new classes.

These classes are “GSButton” and “GSDPad”. Both classes are very similar and could probably be combined into one class given a little more time.

Each of these two classes derive from the CCLayer class and accept images during initialization. They read player input and return their state with a property called “isPressed” for the GSButton and “isPressedLeft” or “isPressedRight” for the GSDPad.

The touch area of each object is currently restricted to the image’s content size, but can easily be extended for better responsiveness.

Game Layer

The last class to talk about here is the “GameLayer”. This class is where all of the other classes are put into use.

As it stands, the GameLayer has one map object, one player object, one dpad object, and one button object.

GameLayer class init method

GameLayer class init method

Durring initialization, the GameLayer loads the games tile set into the shared sprite frame cache. It then creates the map layer with the .tmx tile map file and adds it as a child of the layer(note: if you want to change the name of the map file, this is the place to do so). 

The GameLayer creates the player object and initializes it with the map object and adds the player object as a child of the map object.

The dpad and button objects are created and added as children of the layer as well, and an update is scheduled for the layer.

GameLayer class update method

GameLayer class update method

The update method for the GameLayer class is very simple. it has two jobs at the moment

1- Send info about the current state of the button objects to a singleton class called “VariableStore” that is accessible by all classes.

2 – Call the setViewPointCenter method.

GameLayer class setViewPointCenetr method

GameLayer class setViewPointCenetr method

The setViewPointCenter: method is a method for moving the camera to follow the player originally found here. For now it does the job, but it can be moved and adjusted to incorporate smooth camera movements.

Conclusion

Well, thats about all I have to say about the code of this project without getting into anything too technical. Remember, if you want to know the gritty details about how these classes work, namely the MoveableObject class, you can find a great tutorial here by Paul Firth.

Else, leave me a comment or suggestions.

Thanks for reading!

2D Platform Game IOS Port – Part 1

Introduction

Hi everyone, welcome to my new blog. For my first article, I decided to write about a 2d platform game example I first read about here. The technical details relating to the example can be read on Paul’s blog in the link above, so I won’t go over them again.

The project I have posted is a port of the FREE! source code offered by Paul here, with added support for the FREE! Tiled map editor, and a few other tweaks.

Tiled Map Editor Screen Shot

Tiled Map Editor Screen Shot

cocos2d Logo

cocos2d Logo

The framework i chose to use for this project is cocos2d, a popular open source framework with a large community. More info on the framework can be found here.

Tile Map Design

The biggest deviation from the original source code is the addition of support for the Tiled map editor. With support for Tiled, it becomes very easy to design and insert new maps into your project. but before you go off and start creating all those maps, there are a few things you must know.

You will need a tile layer named “collisionLayer”.

collisionLayer

Layers Box

You can do this by clicking on the “Layer->add tile layer” in the menu bar.

This is the layer that will hold the tiles that represent collidable tiles in the game.

Once you have your collisionLayer, you will need a tile set to accompany it. Note: you can only use one tile set per layer. 

tileset

New Tileset Form

To add a tile set to your map, click”Map->New Tileset”. A form will popup allowing you to browse your hard disk for your tile set. Click ok once you are done loading in your tiles.

Now that you have your tile set loaded into the editor, your going to need to add  some properties to your tiles in order for the game to recognize them as collidable objects.

tilesetWindow

Tileset Box

In the tile set window, right click on the tile that you want to make collidable, then click “Tile Properties”.

tileProperties

Tile Properties Form

You will be presented with a popup window, shown above, and from there you will be able to add the property with Name: “Type” and  value: “Solid”.

This will make it so that the player cannot pass through this type of tile.

Wow, thats a lot! But theres still one more thing we need to do before we can get to the fun part. We need to add an object layer so we can store the players spawn point.

Click on the “Layer->add object layer” and name it “objectGroup” like we did with the collision layer. Now make sure the object group is highlighted in the Layers window and click on the “inset rectangle” button in the toolbar. ir

Click anywhere in the editor window to create a new object in your objectGroup layer.

og

After you’ve gotten it to look like the photo above, right click on the new object and click “object properties”.
op

Name the object “PlayerSpawn” and click “ok”.

Once you are done with all that you are ready to start drawing your map. Make sure the collision layer is highlighted and select the tile that you made “Solid”. Use this tile to fill the map areas that you don’t want the player to be able to move through.

mapping

Now that you have created your masterpiece, its time to save it and upload it into the project. Click “File->Save As” and name the map “testMap”.

Loading Your Map Into The Project

So, I’ve got my new map… what now?

Fire up Xcode, with the project you can download from the Downloads page. Delete the map I built for you :”( and copy yours in. Next view the map file in Xcode and fix the tile set file extension as shown below.

Update: Tiled exports the map with a path that looks something like this:

source="2dPlatformer_Port/2dPlatformer_Port/tileSet.png"

depending where you imported your tile set from. What we want is for the path to look like this:

source="tileSet.png"

otherwise the layer containing that tile set will not show up in the game. The picture below shows what it should look like.

fix

After you have done that, you are ready to build and run the project with your map!!!

Well, that concludes the first part of my blog post. I didn’t expect it to be this long, so I will continue with a part two including detailed information about the code side of the project soon.

The project source can be downloaded from my Downloads page. Thanks for taking the time to read through my blog. If you have any questions or suggestions, please leave a comment below.  If you enjoyed reading my blog and wish to help support my work, please go to the Donate page

Note: donations, although greatly appreciated, are never required.