I moved to a new URL! Check it out!

posts dated from: may 2013

Dev Log: Animations

Dev Log: Animations
Finally got back into C# yesterday and refactored a bunch of my drawing code. I'm basically trying to take SFML and wrap it in a framework that resembles Flashpunk. Last night I got some animations working and I tested with my simple tilemap, and a familiar face from Offspring Fling!

Image


SFML is still proving to be super fun and easy to work with so far, especially since I'm using C#. Also for you C# developers check out Glide, which looks to be a super neato replacement for TweenLite in AS3. I'm planning on implementing it into my framework soon.

I've also been trying to figure out if texture atlasing is necessary with SFML and I can't seem to find any resources on the matter... that is one of the items on my to do list for this framework!

New Super Ninja Slash World Record



Jesse Richmond, also known as YourWifeAndKids has smashed the world record time of Super Ninja Slash. My personal best was 00:50.68, and now the fastest time is now over 2 seconds better!

Seeing any speed runs of my games gives me the warmest and fuzziest feelings. Make sure to follow Jesse on twitch for more!

Workstation!

Image


I've been kinda busy with other stuff lately so unfortunately I don't have any super cool blog posts lined up for this week (yet.) Hopefully I'll be diving back into C# and SFML next week, so for now enjoy the picture of my workstation. (Actually this was taken back in December, so there are some things missing.) This is what I've been using to work on games and watch speed runs for the past 6 months!

Doodle Post

Image

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.)

Dev Log: SFML C# Progress

Image


Nothing too exciting for a blog post today unfortunately, just a quick update on my SFML C# progress. Over the weekend I was able to add tile maps roughly following the tutorial right on the SFML website about using vertex arrays for custom shapes.

It was surprisingly straight forward to get a tile map with custom vertex arrays rolling. My first attempt actually involved using a render target. I rendered all the tiles directly to the render target, then used that target as a texture for another sprite. In theory this works well enough but the size of render target's is limited by the video card. On my main PC workstation I can make a render texture of 16000 something pixels, but my laptop can only handle 8000 something pixels, so this seemed like a dangerous way to do it. I switched to the vertex array thing and now I am super excited to try out different applications of the vertex arrays.

Still on my list of things to do are animations, tweening, collisions, and texture atlas support, as well as Ogmo Editor support. Plus probably a lot of refactoring. When the framework is lookin' better I'll release the source publicly so people can laugh at my code and help improve it or use it.