I moved to a new URL! Check it out!

posts filed under: tutorials

Quick Digital Drawing Tutorial

Quick Digital Drawing Tutorial
Check out this quick digital art tutorial with this doodle yeah! This is a quick run through of my usual techniques that I try to squeeze the best looking image out of the shortest time possible with as little effort as possible because I just want to do a lot of drawings and not focus on one for too long.

Okay so first I'm using Clip Studio which is an amazing piece of software that sometimes you can totally grab for just $20 when it's on sale. I'm drawing on a Wacom Cintiq 22HD.

I always like to show what the final result is first:

Image


Okay! I start with a 30 pixel brush at 100 opacity with a hardness of 60, and a brush density of 80. I make a rough sketch on a layer of 40% opacity. I also usually make the canvas some sort of dull color instead of pure white since I find it way easier to draw, and color on a darker canvas. Also I usually work at double the resolution I plan to export the image as, so all of these images as examples are actually scaled down 50%!

Image


On top of the sketch layer I drop a new layer for the line work. I use a brush that has particles to make it seem like a pencil on paper. With a brush size of 20, hardness 60, particle size 9, particle density 6, and spray deviation of 50 I draw over the sketch on a layer set to 95% opacity.

Disable ESC in Fullscreen on Adobe AIR

Disable ESC in Fullscreen on Adobe AIR
One of the issues with building a desktop application with Adobe AIR is that there is a built in function in the runtime that will cancel any full screen mode when the user pushes the Escape key. This is mostly a functionality of Flash, but it carries over to AIR since AIR is pretty much an extension of the Flash runtime.

Fortunately when you're using the AIR runtime you can actually override the default functionality of the Escape key and keep your application full screen when the user pushes Escape. This came up in Offspring Fling because I was using the Escape key in my UI design. The user pushes Escape to return to the main menu, pause the game, or skip cutscenes, so it was a problem when escape also canceled the game's full screen mode.

The fix for this is super easy and straight forward. First you just need an event listener on the stage for the KEY_DOWN KeyboardEvent.
//listen for key down event and trigger escOverride function
FP.stage.addEventListener(KeyboardEvent.KEY_DOWN, escOverride);
Now here's what the escOverride function looks like.
private function escOverride(e:KeyboardEvent):void {
if (e.keyCode == 27) {
e.preventDefault();
}
}

The keyCode for the Escape key is 27, so whenever a key is pressed the function escOverride is called. If the keyCode was 27, then the preventDefault() function will prevent the default action from being triggered. In this case, it's the "exit fullscreen" action.

There you have it! With just 4 or 5 lines of code total you can prevent your Adobe AIR game from canceling fullscreen when the user pushes Escape. With great power comes great responsibility. (Also note that I believe this is impossible in a normal swf build. The preventDefault() function only works in Adobe AIR.)

AS3 State Machine

AS3 State Machine
State Machines are the greatest thing I've ever discovered when it comes to programming games. More and more I'm beginning to realize that a lot of the structure of the tools I've used is in fact a state machine!

Finite State Machines


To find out exactly what a state machine is, check out this wikipedia article which describes them as "...an abstract machine that can be in one of a finite number of states. The machine is in only one state at a time; the state it is in at any given time is called the current state. It can change from one state to another when initiated by a triggering event or condition; this is called a transition. A particular FSM is defined by a list of its states, and the triggering condition for each transition."

An example of this in action in my games are the guards in Super Ninja Slash. They have a couple of different states. Idle, Alarmed, Shooting, and Dead. That covers all their bases for their behavior.

Without using a state machine, writing code for all of that behavior can quickly become a giant mess of if statements and booleans. With a state machine, I can completely separate all the code for the guard's Idle state, the Alarmed state, Shooting, and Dead.

FlashDevelop to iPad Workflow

FlashDevelop to iPad Workflow
I recently got one of them new fangled iPad things and I heard on the internet that Adobe AIR is actually pretty decent at building things for iOS. Offspring Fling used Adobe AIR so I'm already a little familiar with how to build for Windows and Mac, but it turns out that iOS is an entirely different beast... sort of. The set up and configuration of the whole workflow can be a nightmare, but once it's over then you'll have a set up that lets you push F5 to build right to your device!

Follow along on this series of text and images and hopefully you will be enjoying pushing the F5 key on your keyboard and seeing an app pop up on your iOS device! Also put on some relaxing music because some parts of this tutorial might be hard to understand and frustrating. I'm using Windows 7 64-bit for this.

FlashDevelop with HaXe NME and HaXePunk

FlashDevelop with HaXe NME and HaXePunk
I spent most of yesterday diving into a whole new world of magic and fun: Haxe. I was hesitant at first because I was dreading the whole ordeal of setting up a new development environment, but it turned out to be way more straight forward than most set ups I've experienced.

I ended up getting a quick demo of thousands of entities rotating, scaling, and alpha blending at a steady 50-60fps with the Windows build of HaxePunk, and that has me pretty excited!

Image


Follow along as I take you on a journey of code and game development! (For reference, I'm using Windows 7.)

Adobe AIR Window Scaling

Adobe AIR Window Scaling
Over the past week I added some menus and options to my Global Game Jam game remake. I'm doing this super early on in the game's life because having some awesome polished menus makes it feel like a "real" game, which motivates me to work on it more. One of the first things I did for the game options was window scaling. The game natively runs at 320 x 240, so obviously players are going to want some various scaling options unless they really want to run it at 1x and barely see the game on their screens that are now probably 4000 pixels wide.

The awesome thing about working in AIR is that it will automagically resize the game's window to the size of the flash stage, so all I have to do is set the stage width and the stage height and the window will resize to match. However, there are some funky issues that can arise.

The flash stage has different scaling modes that you can use. There's EXACT_FIT, NO_BORDER, NO_SCALE, and SHOW_ALL. For the case of this game, I'm using EXACT_FIT after I resize the window. The reason for this is so that players with super huge monitor set ups can scale the window themselves.

This was actually a problem with Offspring Fling until the lastest update. I had a player that had a desktop width of over 4000 pixels because of their multimonitor set up. They couldn't play in fullscreen mode because it would scale across both monitors, and they couldn't play in windowed mode because it was too tiny. Changing the window mode to EXACT_FIT made it so anyone can scale the window to whatever size they want. I could've also used SHOW_ALL, which would maintain the game's aspect ratio as it scaled, but some users wanted to stretch the game to fill their entire monitor. (WHY?!)