[Contain] Released for iOS (Free)

Contain, my latest game for the iPhone and iPod Touch has been released.
This project was great for improving my skills with both Objective-C and Xcode.
I look forward to updating it to include Openfeint and other enhancements.

It is available as a free download.
You can check it out on the app store HERE

And here, I leave you with some amazing video footage :P

[Game Maker] Grid Movement -PART 1- The Basics

If you find this tutorial helpful, please consider showing support by trying my latest game
Insane Number Run
Insane Number Run***

Accompanying video tutorial. Please watch at fullscreen with quality set to 480p or higher.

Note:
You can preview an implementation of grid based movement here
When you are finished, be sure to check out further lessons in this series for grid movement:
Part 2: Collision Detection
Part 3: Character Animation

And now to the lesson!

1) Start a new project

2) Add a new object and call it obj_player

3) Inside obj_player, Add Event -> Create create and add a piece of code code containing:

/*
   Initialize required variables
*/
gridSize = 32;     // Should be power of 2 (...8,16,32...)
isMoving = false;  // Keeps track of when player is moving
moveTimer = 0;  // Counts down from grid size each step
moveSpeed = 4;     // Do not set higher than grid size!
speedX = 0;
speedY = 0;

 

4) Inside obj_player, Add Event -> Step step and add a piece of code code containing:

/*
   When not moving, check to see if a direction key is held.
   If so, assign x/y speed and change status to moving.
*/
if (isMoving == false)
{
    if (keyboard_check(vk_right))
    {
        isMoving = true;
        moveTimer = gridSize;
        speedX = moveSpeed;
        speedY = 0;
    }

    if (keyboard_check(vk_up))
    {
        isMoving = true;
        moveTimer = gridSize;
        speedX = 0;
        speedY = -moveSpeed;
    }

    if (keyboard_check(vk_left))
    {
        isMoving = true;
        moveTimer = gridSize;
        speedX = -moveSpeed;
        speedY = 0;
    }

    if (keyboard_check(vk_down))
    {
        isMoving = true;
        moveTimer = gridSize;
        speedX = 0;
        speedY = moveSpeed;
    }
}

/*
   When moving, subtract from moveTimer our moveSpeed value
   and update location relevant to set speeds.
   Stop moving when moveTimer reaches zero.
*/
if (isMoving == true)
{
   x += speedX;
   y += speedY
   
   moveTimer -= moveSpeed;
   if (moveTimer == 0) isMoving = false;
}

 

5) Add obj_player to a room, preferably aligned to the grid size which you set in obj_player

There! You should now have a simple implementation of grid based movement. You can play around with changing gridSize to other values, such as 8 or 16 for tighter grid movement.

You can download the example gmk for this tutorial HERE

Incorporating what I discussed in my previous tutorial, you can also download a version which betters the 4 direction input HERE

Feel free to contact me about any questions or comments!

null

[Game Maker] Bettering 4-Direction Player Movement

If you find this tutorial helpful, please consider showing support by trying my latest game
Insane Number Run
Insane Number Run***

This tutorial assumes you have some experience with Game Maker’s scripting language, GML.
However, even if you are unfamiliar with it, you should still be able to follow along and find this useful if you take the time to understand it.

Controlling a character in any game should be as intuitive as possible for the player.
Thus, control should function in a predictable manner and avoid any little quirks that could arise and leave your player falling down an endless pit.

One small quirk I’d like to address here revolves around 4 direction character control, and the issue of key direction input/release dominance.
To help illustrate this issue, play around with the character in this example:
BAD CONTROL EXAMPLE

Take note of what happens when you have one direction held and then press down another while holding on to the first direction. Then, try holding down the second direction first and press down the original direction afterwards. Do you notice anything odd?

If you play around with the rest of the directions, trying the different combinations of starting with one direction and then pressing and holding another, you will find there are keys with dominance over other keys. It doesn’t care which key was pressed last, but only which key returns true. But if more than one key direction returns true, it simply takes the first key returning true and uses it.

We will now look at one solution for this issue.

Note: This solution includes both ARROW/WASD key movement.

1) Start a game maker project and create an object called obj_input and set it as persistent

2) Inside obj_input, add Event -> Create create

3) Inside the Create event, add -> Code code for initializing a few global variables

globalvar
g_keyDirection,             // holds value for active direction key pressed
g_keyDirectionIsPressed,    // is true when direction key first pressed down
g_keyDirectionIsReleased;   // is true when direction key is released

g_keyDirection = -1; // initialize as -1 to ensure no initial false input
g_keyDirectionIsPressed = false;
g_keyDirectionIsReleased = false;

4) Inside obj_input, add Event -> Begin Step step

5) In this event, add -> Code code to check for the last direction pressed and set g_keyDirection/g_keyDirectionPressed accordingly:

    // First, clear global Pressed/Released states
g_keyDirectionIsPressed = false;
g_keyDirectionIsReleased = false;

    // Second, Check for ARROW or WASD presses
if (keyboard_check_pressed(vk_right) 
or  keyboard_check_pressed(ord('D')))
{
    g_keyDirection = 0;
    g_keyDirectionIsPressed = true;
}
else 
if (keyboard_check_pressed(vk_up)
or  keyboard_check_pressed(ord('W')))
{
    g_keyDirection = 90;
    g_keyDirectionIsPressed = true;
}
else 
if (keyboard_check_pressed(vk_left)
or  keyboard_check_pressed(ord('A')))
{
    g_keyDirection = 180;
    g_keyDirectionIsPressed = true;
}
else 
if (keyboard_check_pressed(vk_down)
or  keyboard_check_pressed(ord('S')))
{
    g_keyDirection = 270;
    g_keyDirectionIsPressed = true;
}

Okay, this is great, but what about key release variances? If a player has two keys pressed and releases one of them, it should always return the direction to the remaining key held.

6) Add the following code below the code we just wrote in the Begin Step event

   // Third, Check for ARROW or WASD releases
if (keyboard_check_released(vk_right) // Arrow keys
or  keyboard_check_released(vk_up)
or  keyboard_check_released(vk_left)
or  keyboard_check_released(vk_down)
or  keyboard_check_released(ord('D')) // WASD keys
or  keyboard_check_released(ord('W'))
or  keyboard_check_released(ord('A'))
or  keyboard_check_released(ord('S')))
{
    g_keyDirectionIsReleased = true;
    g_keyDirection = -1; // Make sure to clear this first
    
    if (keyboard_check(vk_right)) g_keyDirection = 0;   else
    if (keyboard_check(vk_up))    g_keyDirection = 90;  else
    if (keyboard_check(vk_left))  g_keyDirection = 180; else
    if (keyboard_check(vk_down))  g_keyDirection = 270; else
    if (keyboard_check(ord('D'))) g_keyDirection = 0;   else
    if (keyboard_check(ord('W'))) g_keyDirection = 90;  else
    if (keyboard_check(ord('A'))) g_keyDirection = 180; else
    if (keyboard_check(ord('S'))) g_keyDirection = 270;
}

There, once you have added obj_input to your game’s starting room (remember to make it persistent!), you should now be able to have any object in your game access the g_keyDirection variable and set its movement accordingly. You also have access to g_keyDirectionIsPressed and g_keyDirectionIsReleased for when you need to use those states.
For example,

7) Create an object called obj_player

8) Inside obj_player, add Event-> Step step containing -> Code code for moving the player accordingly

    // Set speed and direction when key pressed
if (g_keyDirectionIsPressed)
{
    speed = 4;
    if (g_keyDirection == 0)   direction = 0;
    if (g_keyDirection == 90)  direction = 90;
    if (g_keyDirection == 180) direction = 180;
    if (g_keyDirection == 270) direction = 270;

    // Or simply... 
    // direction = g_keyDirection;
}

    // Set speed and direction when key released
if (g_keyDirectionIsReleased)
{
    if (g_keyDirection == -1)  speed = 0; // Stop if no direction pressed
    else if (g_keyDirection == 0)   direction = 0;
    else if (g_keyDirection == 90)  direction = 90;
    else if (g_keyDirection == 180) direction = 180;
    else if (g_keyDirection == 270) direction = 270;
}

 

Now, the second direction key pressed will always be dominate when two keys are pressed down, and when a direction key is released, the remaining key pressed will take over as one would hope.
The character movement should now be like this:
BETTER CONTROL EXAMPLE

Again, notice the difference when compared with the BAD CONTROL EXAMPLE

You can download the completed example gmk for Game Maker here:

[Windows Version]

DOWNLOAD

[Mac Version]

DOWNLOAD

If you have any questions or comments, feel free to contact me!

null

[Epic Tic Tac Toe] Released for iOS (Free)

After what has felt like years of development (maybe it has been) I have finally released my first game for iOS devices.
See here: Epic Tic Tac Toe on iTunes

Work on the game began early this year, but despite its apparent simplicity, many discouraging frustrations surfaced. I had to learn a new engine (iTorque 2d) and the ins and outs of working through Apple’s process for publishing a game to their service. All of this was completely new and at times confusing. These things mixed with pockets of lacking motivation and haunting distraction really made this process painstakingly tedious.

But, what was truly accomplished?

1) A game was actually completed from start to finish!

2) I learned how to register and form an official business with my friend Cody Penner (DagurDragon.com)

3) Improved skill at working with engines at both the high (scripting) and low (programming) levels.

4) Maintained persistence and worked towards completion, even when unmotivated.

5) Established a foundation for further games (hopefully even more epic) to be released.

And now its time to see how yet another tic tac toe game is received out there. But I do believe it does have its own unique charm which should help it shine above the plethora of others.

Epic Tic Tac Toe can be downloaded for free from the app store.

Epic TTT Screenshot

I Survived the Canadian Games Conference

After attending an evening at the Canadian Videogame Awards, and two full days of the Canadian Games Conference, I’m totally drained. My brain is full of wonderfully amazing insight from so many amazing people and ready to explode!

I went into the conference with uncertainty, not knowing how I would fit into this whole scene as an aspiring independent games developer. To be honest, I was somewhat frightened.

But that fear soon went way (actually, it took three days for it to mostly go away). I registered for the event in hopes of improving my social networking skills, historically being as effective as a level 10 Magikarp.

So, how was it? Amazing. Tonight I cannot express how beneficial this experience was. I feel that I received sound instruction on many topics from a great variety of people within the creative industry of game development. This is surely not a simple industry to step into, so with it comes great minds, and that was proven.

I will have to post a future article regarding the ‘little’ details that I found most profound. But a snippet … *cough*

“Express your creativity and soul though the tiniest of details. This can emotionally engage your players and give your game its own unique life.” – Paraphrased from multiple people.

As for the networking. Well… it went much better than I expected. I got uncomfortable, moved outside my norm, and launched into conversations with random people in a place where I felt like noob.

But it worked. My proud-filled fear of exposing my imperfections through naturally awkward social skills began to dissipate. And I became a better person for it. I have made some great contacts, and received by word of mouth further avenues in which to extend those contacts further. Huzzah!

But now its late and my body is demanding rest!

Just a final shout out to anyone who attended the conference. You were all a super ambitious group of people to hang out with. I look forward to attending next year.