[Drop Cube] Released for Android

IconThe concept for this game originally came from a spare 20 minutes at a 48hour game jam in Vancouver in which I needed something to do. See here: Fail Fall

I just finished the more refined version with GameMaker:Studio for Android devices. I can’t say enough about how much easier GameMaker makes things for development. I also hope to have Drop Cube submitted to iOS devices in short order.

Available on Google Play:
Paid Version / Free Version

 

Game Description:

Drop Cube will put your reflexes and steady hand to the test. Utilize refined tilt controls to dodge obstacles as you free fall increasingly faster towards terminal velocity.

Choosing the safer route will keep you in action longer, but greater risk garnishes greater reward. Find out how your skills stack up with Drop Cube!

Features:
– Responsive Tilt Controls
– Local Scoreboard
– Risk Based Scoring
– No Splash Screens!
– Retro Themed Music

[Book Review] Unity iOS Game Development Beginner’s Guide

While going through this book, I tried to imagine myself as a beginner with little to no previous experience with Unity. With that perspective in mind, I felt like I came away with little to show for my time invested into this text. That isn’t to say there wasn’t useful information to help one get started out. However, there just didn’t seem to be an appropriate pacing or coherent order of material to help me feel confident when continuing with Unity.

To the book’s credit, I never felt like it was swamping me with too much information at once. It stayed reasonably comfortable to follow along with and had me never feeling completely lost. But again, the general topics covered seemed to jump around with little warning, at times feeling like a wild ride through someone’s last minute check list. I had a difficult time anticipating where the instructions were going to inevitably lead me, and it offered myself only a slight sense of being an active participator in its exercises.

An example to help relate the book’s textual inconsistency is revealed by the fact that quiz questions are given at the end of the first two chapters but fail to appear in the following chapters. This may seem trivial, but it is an odd pattern to begin with and to suddenly drop. And just so everyone knows, I love quiz questions at the end of a chapter! :D

I wish the book spent less time on how to use third party plugins and more time going through real world examples of how to achieve varied control styles or game mechanics tailored for iOS devices. I believe it could have benefited from including such a topic as raycasting, something which I considered vital for my own projects, as the iOS version of Unity does not recognize user input on game objects like the PC or Mac version. For example, the OnMouseDown() callback is not recognized on game objects for iOS, thus requiring raycasting to be used inorder to directly interact with objects when touched.

I found too many subjects just briefly touched upon. Some chapters have a sense of being incomplete and not following through with teaching the functionality promised in the book’s advertisement. I wouldn’t be so bothered by this fact if the book didn’t advertise itself with overhyped expectations.

Being somewhat of an experienced Unity user, I was satisfied with some useful morsels of information which I gleaned from this book, but I am glad that I have the experience already behind me to fill in the blanks that I felt were missing on some subjects.

If you are a fledgling beginner with Unity and iPhone development, this book might be okay to start with. Despite its shortcomings, I still found myself able to get through it quite easily and learn some new things along the way. But, don’t expect it to make you a whiz or even leave you with a well rounded knowledge of Unity basics. Expect further books, tutorials, and hands on experience to fill in the other basic concepts you will need to know along your adventures.

Book’s official site

 

FINAL VERDICT: 5/10

null

[Game Maker] Grid Movement -PART 3- Character Animation

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

In the case of being too ADD, you can download the completed project for this lesson here:

[Windows]
Part 3 Editable Project Download

[Mac]
Part 3 Editable Project Download (Slightly outdated)

If you have not already done so, I highly suggest going through parts 1 and 2 of this series first, as this lesson will be based upon their existing code.

Part 1: The Basics
Part 2: Collision Detection

Welcome to part 3 of my series on Grid Based Movement for Game Maker!
In this lesson, we are going to look at implementing character animation for our player object. There are a few ways to go about doing this with Game Maker, but today I will teach one of the techniques which I prefer and continue to use myself.

The result of this lesson should look like this: Grid Animation Example

Alright, onto the Lesson!
First, lets get ourselves some sprite strips to work with. Go ahead and download the following files to use for our lesson. You can use your own if you like, but note that you will likely need to make minor adjustments to the example code if you do so.

Sprite Strip 1
Sprite Strip 2
(Big thanks to Cody Penner for the sprites! )

For this lesson, we are going to continue where we left off from Part 2: Collision Detection. You can download the completed editable project for that lesson here: Part 2 Project Download

With our existing project from Part 2, add the new sprite strips to the Sprites folder.
The first 4 images of the sprite strip are for the standing “animations”, one for each direction. Following them are the walking frames for all 4 directions containing 4 images for each animation.

Noting the placement, order and length of our images/animations within the sprite strip is important. We will be using this information to properly set up our animations for our player object. Be aware that the numerical values of the images in the strip are zero-based. This means that 0 refers to the first image, 1 to the second, 2 to the third, and so on. We can explicitly change an instance’s displayed image at runtime by modifying its built in image_index variable, setting it to the appropriate offset we want, relevant to the current sprite strip. Soon, you will see how this is used to create smooth walking/standing animations for our grid based movement system.

Before doing anything else, open up the properties for obj_player and change Sprite to one of the sprites we just imported.

Within obj_player, highlight the Create Event and open the existing Execute Code action.
Below the already existing code in our action, insert the new variables we will use to support our animation system.

// ...PREVIOUS OLDER CODE

    // We will now keep track of our direction
direction = 270;
    // Used to help set standing animations
justStoppedMoving = true;

    // Initialize animation properties
animIndex = 0;         // first frame in current animation
animLength = 0;        // current animation length in frames
animSpeed = 0;         // current animation speed
animIndexRelative = 0; // relative from first frame of animation

    // Set animation length properties
animLengthStanding = 1;
animLengthWalking  = 4;

// Set animation speed properties
animSpeedStanding  = 0.0;
animSpeedWalking   = 0.2;

    // Standing animation index offsets
animIndexStandRight = 0;
animIndexStandUp    = 1;
animIndexStandLeft  = 2;
animIndexStandDown  = 3;

    // Walking animation index offsets
animIndexWalkRight = 4;
animIndexWalkUp    = 8;
animIndexWalkLeft  = 12;
animIndexWalkDown  = 16;

 

Because we want our character facing downward at the start, we will set direction to 270
As a refresher: right = 0, up = 90, left = 180, down = 270
We have also created a new variable justStoppedMoving which will enable us to easily manage code for when our player stops walking. This can be helpful for setting standing animations.

Following that, we have initialized some required properties to make our animation system work. animIndex, animLength, animSpeed and animIndexRelative hold the status of the active animation.
animIndex receives the value of the first frame in the animation we want to use. We can easily assign it one of the animation indexes we have created, such as animIndexWalkRight.
animLength holds the length of the current animation in frames. We will assign in the value from either animLengthStanding or animLengthWalking.
animSpeed is simply how fast our animation will animate. Make sure to keep the value relatively small. We will assign it the value held by animLengthStanding or animLengthWalking.
Finally, we initialized animIndexRelative. This variables holds the current animation’s frame value relative to its starting animIndex frame. It will allows us to repeatedly cycle through and select the appropriate frames needed for each animation.

With that set up, we are now going to set up a script so that we can comfortably change the required properties needed to set up the appropriate animations we want.

In GameMaker’s ‘Scripts’ folder, create a new script called ‘SetAnimation’
Inside this script, go ahead and input the following code:

animIndex = argument0;
animLength = argument1;
animSpeed = argument2;

 

This script takes 3 arguments. It will be used to change our animation Index, Length, and Speed.
With that inputted, close it up and once again open the properties for obj_player.

We are now going to add the code which will make our animation system work. But we are not going to add it to the Normal Step Event. Instead, we will add an End Step Event, and place our code inside there. By placing our animation system here, we separate it from our Normal Step Event code, ensuring the intended animations are drawn after all our other updates are finished.

Inside the End Step event, add a new action -> Execute Code. Inside this code action, place the following:

image_index = animIndex + animIndexRelative;
animIndexRelative += animSpeed;

if  (animIndexRelative >= animLength)
{
    image_index = animIndex;
    animIndexRelative = 0;
}

 

With that code in place, the animation will always be within our set boundaries.
As long as we use the SetAnimation script, we can be certain that our animation system will function properly.

We are now going to return to the Normal Step event for obj_player and edit the existing code action.
We will start by adding a new line at the bottom of our existing code for when our character has just stopped moving.
Add the line of code where it is commented: // *** NEW CODE ***

//... OTHER CODE

if (isMoving == true)
{
    x += speedX;
    y += speedY

    moveTimer -= moveSpeed;
    if (moveTimer)
    {
        isMoving = false;
        justStoppedMoving = true; // *** NEW CODE ***
    }
}

 

We can now return to the top of the code action and utilize the justStoppedMoving variable to set standing animations when our player finishes walking.

    
    // Set standing animations if just stopped
if (justStoppedMoving == true)
{
    justStoppedMoving = false;

        // Set appropriate standing animations
    if (direction == 0)
        SetAnimation(animIndexStandRight, animLengthStanding, animSpeedStanding);
    else
    if (direction == 90)
        SetAnimation(animIndexStandUp, animLengthStanding, animSpeedStanding);
    else
    if (direction == 180)
        SetAnimation(animIndexStandLeft, animLengthStanding, animSpeedStanding);
    else
    if (direction == 270)
        SetAnimation(animIndexStandDown, animLengthStanding, animSpeedStanding);
}

    // ... Other Code

 

Based upon the character’s current direction, we have effectively set the appropriate standing animation. But up until this point, we haven’t written any code to change the character’s direction or set a walking animation.

Just below the code we wrote, we will modify the existing code within the keyboard_key() check statements to include an updated direction. We will also set the appropriate walking animation when our player is able to move.
Go ahead and modify our existing code to include keeping track of our current direction, as well as setting the appropriate animations. Note that this code will also set an appropriate standing animation if the player is blocked and unable to move. This allows the player to allows face the direction they intend to.

if (isMoving == false)
{
         // Perform 4 direction keyboard and grid checks
         // for setting appropriate movement and animation
    if (keyboard_check(vk_right))
    {
        direction = 0; // Keep track of new direction

        if (obj_grid.cells[(x div 32) + 1, y div 32] == 0)
        {
            isMoving = true;      // Lets start moving
            moveTimer = gridSize; // Ready moveTimer for countdown
            speedX = moveSpeed;   // Set horizontal speed
            speedY = 0;           // Set vertical speed
            SetAnimation(animIndexWalkRight, animLengthWalking, animSpeedWalking);
        }
        else
        {       // Set standing anim for new direction
            SetAnimation(animIndexStandRight, animLengthStanding, animSpeedStanding);
        }
    }
    else
    if (keyboard_check(vk_up))
    {
        direction = 90;

        if (obj_grid.cells[x div 32, (y div 32) - 1] == 0)
        {
            isMoving = true;
            moveTimer = gridSize;
            speedX = 0;
            speedY = -moveSpeed;
            SetAnimation(animIndexWalkUp, animLengthWalking, animSpeedWalking);
        }
        else
        {
            SetAnimation(animIndexStandUp, animLengthStanding, animSpeedStanding);
        }
    }
    else
    if (keyboard_check(vk_left))
    {
        direction = 180;

        if (obj_grid.cells[(x div 32) -1, y div 32] == 0)
        {
            isMoving = true;
            moveTimer = gridSize;
            speedX = -moveSpeed;
            speedY = 0;
            SetAnimation(animIndexWalkLeft, animLengthWalking, animSpeedWalking);
        }
        else
        {
            SetAnimation(animIndexStandLeft, animLengthStanding, animSpeedStanding);
        }
    }
    else
    if (keyboard_check(vk_down))
    {
        direction = 270;

        if (obj_grid.cells[x div 32, (y div 32) + 1] == 0)
        {
            isMoving = true;
            moveTimer = gridSize;
            speedX = 0;
            speedY = moveSpeed;
            SetAnimation(animIndexWalkDown, animLengthWalking, animSpeedWalking);
        }
        else
        {
            SetAnimation(animIndexStandDown, animLengthStanding, animSpeedStanding);
        }
    }
    // ... OTHER CODE
}

 

With that code in place, we now have a functioning animation system where the character will animate according to our set parameters determined by the sprite strip.
A benefit to this animation system is that sprite strips, which share the same animation parameters, can be swapped at any time with ease! Simply change the character’s sprite_index and the change will be immediately reflected, no matter what state the character is in!

If you want to have your standing animations the same as your walking animations (think Dragon Warrior/Quest), then simply change the standing properties to be the same as the walking animation properties, and you’re good to go!

If you have any questions or suggestions, I would love to hear from you!
And if you’re on Twitter, find me at @Nehemius

null

[Game Maker] Grid Movement -PART 2- Collision Detection

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

Accompanying video tutorial. Suggested to watch in fullscreen at quality of 480p or higher:

NOTES
***
If you have not already done so, I highly suggest going through Part 1 of this tutorial series as what follows will be based upon its existing code. Links to other lessons can be found here:
Part 1: The Basics
Part 3: Character Animation

An editable gmk for this lesson can be downloaded here: Part 2 Download
***

1) Create a new object, naming it obj_grid

2) Create a new object, naming it obj_block

3) Assign obj_block a 32×32 sprite

Our obj_grid instance is going to manage our grid’s collision information. It will initialize and hold a 2-dimensional array for storing locational information in our rooms. We will use the number 0 to represent an empty location, and the number 1 to represent a wall

4) Inside obj_grid, Add Event -> Create create, then add a piece of code code containing:

var i, j; // Not required but helps speed up 'for loop'

// Use the room's height and width divided by grid size (32) to
// initialize grid with 0
for (i = 0; i <= (room_width div 32); i += 1)
{
   for (j = 0; j <= (room_height div 32); j += 1)
   {
      cells[i,j] = 0;
   }
}

// This 'with()' statement will cycle through all obj_block instances
// within our rooms and use their relative x/y properties
with(obj_block)
{
   // Use block's x/y divided by grid size to set relative location
   // in cells[x,y] array to 1
   other.cells[x div 32, y div 32] = 1; // 'other' refers to obj_grid

   // For performance, we can remove the instance
   instance_destroy();
}

 

Now we are going to add some conditionals to our keyboard_check() blocks from part 1 to see if the corresponding direction next to our player is free. The code to be added will be marked by the comments ‘// <- ADD’

5) Inside obj_player -> Step step -> piece of code code, modify to match:


if (isMoving == false)
{
    if (keyboard_check(vk_right))
    {
        if (obj_grid.cells[(x div 32) + 1, y div 32] == 0) // 

 

With this work done, we can now set up our room with walls to run into. Before doing so, make sure you have a 32×32 background tile to represent as a wall.

6) Go ahead and add the wall tiles to our test room, anywhere you like, making sure to use a 32×32 grid size in the room editor’s settings.

7) Place obj_block instances on top of the tiles you just placed

8) After selecting the room’s ‘Settings’ tab near the top, find and click the button titled ‘Creation code’. Once doing so, add this code:

instance_create(0,0,obj_grid);

There! Making sure you have obj_player in the room, go ahead and run your level. Your player should now properly detect the walls you have set out. Notice that the actual wall instances are removed, and only the more efficient background tiles remain.

Again, feel free to contact me with any comments or questions.
Happy coding!

null

Global Game Jam Vancouver 2012

Vancouver Global Game Jam 2012 Poster

This past weekend I had the opportunity to attend the Global Game Jam in Vancouver. If you are into game development, I highly recommend joining such an event when the chance arises.

I have attended a 48 hour game jam before but this was the first jam in which I worked with a team of people. I had decided that this time, I would focus on assisting rather than leading.
I ended up working with five other awesome people, using C# with XNA Game Studio. This was really outside of my knowledge base as I mainly know C# through however it relates to C++ and I have never touched XNA.

But being slightly uncomfortable with what your are doing is what makes this experience great. Learning new things in such a short and exciting time is so rewarding. At the same time, you get to meet so many people in the same situation as you, struggling to the last minute to complete something, fueled by limited sleep and caffeine injections.
Under this pressure, you get to meet people in such a different way. Certain formalities may be lost at 4am of the second night.

Something I enjoyed most of all was walking around to different groups and seeing if I could assist them debug any problems they were having, especially with groups using Game Maker. The excitement from other groups also made me excited to see their successes, especially when they had never made a game before!

My group and I struggled to get our game finished on time, getting about half of what we wanted done. But despite that, it was great fun. After programming alone for so long, it was a fantastic experience to work with others. Having now returned home, I am left slightly depressed to be once more alone with my code. Maybe I should get out more!

I don’t have a playable link to the game I worked on, so instead, here’s a link to a small game I made in 20 minutes while at the jam! I call it Fail Fall
Please, hold the applause :P

Also, I’d like to highlight one game I especially loved that came from the jam: Pyramid Defense
Be sure to check it out!