William Mora

Martian Run! Open-Source Game with LibGDX

A few months ago I wrote a tutorial for a 2D video game with libGDX, using box2d and scene2d. Many of the things I explained in the tutorial have changed a bit to improve performance and make the final game more of a complete product since one of my goals since day 1 of that project was to publish it in Google Play. So far I’ve received mostly positive feedback for the tutorial (thanks!). However, there were a few things I did not cover in the tutorial that I’m sure people would be interested in: I did not explain how to add the menu layer to the game nor how to integrate the game with Google Play Game Services or AdMob, both which were included in the final version.

SlidingTabs Android Library

This library project is on GitHub.

With the release of Android Studio 1.0, one of the things to notice is that there’s an option to import an Android code sample. All these samples are available on GitHub/googlesamples.

import sample

Snackbar Android Library

This library project is on GitHub along with an example app.

Google’s Material Design documentation introduces a new component used for quick feedback called Snackbars. The document describes them as follows:

OpenFeed - Android L Twitter Client with RecyclerView and CardView Widgets

With Google’s announcement of the new version of Android (codename L) last month. I installed the preview SDK on my Nexus 5 and all of my apps worked pretty good except for Twitter which would not even open.

Up in the Air

Since I decided to join one game a month, I need to come up with new ideas. Having the world cup this time around, I put myself in “hackathon mode” and developed Up in the Air over a weekend. It’s very simple (yes, even more simple than Martian Run!) but I really had a lot of fun playing around with the physics involved.

In case you are wondering, the game is done with libGDX.

Hope you like it!

I'm Joining One Game a Month!

After finishing my last game, Martian Run!, I am feeling inspired to keep working on small games. For that, I decided to join One Game a Month. I really hope to get some XP! :D

Here’s my profile. Martian Run! is already submitted.

LibGDX Tutorial - A Running Game with libGDX - Part 5

Check out part 1 for the project and world setup! Check out part 2 for implementing controls for our runner! We introduced our enemies on part 3. We rendered our background and ground on part 4.

Remember the code is on GitHub. Graphics were made by Kenney. Also, a final version based on this tutorial is on Google Play.

LibGDX Tutorial - A Running Game with libGDX - Part 4

Check out part 1 for the project and world setup! Check out part 2 for implementing controls for our runner! We introduced our enemies on part 3.

This is part 4 of a tutorial on writing a 2d running game. Remember the code is on GitHub. Also, a final version based on this tutorial is on Google Play.

LibGDX Tutorial - A Running Game with libGDX - Part 3

Check out part 1 for the project and world setup! Check out part 2 for implementing controls for our runner!

This is part 3 of a tutorial on writing a 2d running game. Remember the code is on GitHub. Also, a final version based on this tutorial is on Google Play.

LibGDX Tutorial - A Running Game with libGDX - Part 2

Check out part 1 for the project and world setup!

This is part 2 of a tutorial on writing a 2d running game. Remember the code is on GitHub. Also, a final version based on this tutorial is on Google Play.

LibGDX Tutorial - A Running Game with libGDX - Part 1

I’ve always liked 2d running games. When I first got an Android phone, I played iRunner for hours, and at the time I seriously wanted to develop a game like that. A lot of time has passed since but I finally had the time to put together a simple, running game using libGDX. A final version based on this tutorial is on Google Play.

LibGDX is one of the nicest projects I’ve followed over the past few years and when I began looking into different video game development frameworks, it was definitely the one that provided the most features and provided the best performance for my then crappy phone :). If you have time, I recommend reading its creator’s post on releasing version 1.0.

Angular Espresso - AngularJS, CoffeeScript and Express

UPDATE: This post is now outdated. Check out the project’s git page for the latest info on Angular Espresso.

AngularJS is a powerful framework maintained by Google. I started playing around with it a few weeks ago and I think it is great for developing web apps. If you are a used to using jQuery for DOM manipulation and/or your views’ logic, you’ll have to change your approach and change the way you write dynamic views. Best of all, AngularJS is more than that: you could also have models, controllers, services and use partial views to develop a true, behavior-driven web app.

The AngularJS team has an angular-seed project that is very useful as a starting point for an AnglarJS app. There’s also an extension of that project that integrates Express with AngularJS.

Node.js Tutorial - Building a Chatroom with Express.js + Socket.IO

In this tutorial we’ll see the basics of creating a Node.js project with two of its most popular modules: Express.js and Socket.IO. We’ll build a simple chatroom from scratch, like those from the early Internet days :P.

The final code is on GitHub, here’s the link.

Requirements

We are going to be building the project from scratch, so the only requirement is that you install, of course, node and npm (if not included with node). Also, I assume you know JavaScript. If you don’t, I totally recommend JavaScript’s track at Codecademy.

Creating a Project

Create the folder where we’ll have our project, we’ll be working from here from now on.

In Node, we don’t really create a project with a specific folder structure, but create an app file instead; that is, the file that will be executed as the node application. You may name the file as you want; in most of the projects I’ve seen it named either app.js or server.js. Since we’ll be building a web server, let’s go with server.js.

Learning CoffeeScript

Since there’s so much fuzz about CoffeeScript these days, I thought it would be nice to cover the basics of the language and publish it on GitHub. You can take a look at it and share your thoughts in the comments section. The repo is a work in progress.

Repo: https://github.com/wmora/learning-coffeescript

See the README.md section for more details.

SpinnerSimpleDateModel

Here is the code for a JSpinnerModel that handles Date objects in simple format (e.g. ‘dd/MM/yyyy’). It extends a SpinnerDateModel so most of the code is based on that class. This class assumes that values are separated by a slash (/). The reason why I created this was based on a client’s requirement where I could only display the date in simple format and select the calendar using a JSpinner:

SQL: Exists Condition

The SQL EXISTS condition is a boolean function that returns true if the condition is met. The syntax is pretty simple:

SELECT * FROM TABLE WHERE EXISTS(_subquery_);

Alternatively, you can use NOT EXISTS(_subquery_). An example of the function is the following:

SELECT utc.table_name    
 FROM user_tab_cols utc     
 WHERE utc.column_name='ACCOUNTID'
 AND NOT EXISTS(SELECT uc.table_name     
   FROM user_constraints uc     
   WHERE uc.table_name=utc.table_name     
   AND uc.r_constraint_name='SYS_C00229824')     
   ORDER BY utc.table_name;
 

The query looks for all the tables that contain the column ACCOUNTID and from those tables, only get the ones that don’t make reference to the constraint SYS_C00229824.

How to Modify Swap Size - Ubuntu 10.04

When installing Ubuntu, I was never asked about the desired size for my swap size. Oracle recommends to use at least 2GB of memory in order to create a database, let alone run it. With help from this excellent post from LinuxReaders, I expanded my swap size to 2GB (again, Oracle’s recommended size for 11g) by executing the following:

$ dd if=/dev/zero of=/tmp/swapfile bs=1MB count=2048
2048+0 records in
2048+0 records out
2048000000 bytes (2.0 GB) copied, 36.257 s, 56.5 MB/s
$ mkswap /tmp/swapfile
mkswap: /tmp/swapfile: warning: don't erase bootbits sectors
       on whole disk. Use -f to force.
Setting up swapspace version 1, size = 1999996 KiB
no label, UUID=aa8617a8-9500-498e-90da-f5164190ad00
$ sudo swapon /tmp/swapfile

Change Screen Brightness From Terminal (Ubuntu 10.04)

If you want to change the screen brightness in Ubuntu (I can’t change it using the keyboard shortcuts or the Ubuntu Power Management menu), open a terminal and execute the following:

sudo setpci -s 00:02.0 F4.B=xx

Where xx is the desired brightness in hex ranging from 0 (brightest) to FF (no brightness at all). I usually change it to CA when working on battery.

Cheers!

What This is About

Hello!

Random tech tips, thoughts, etc.

You can follow me on Twitter @_williammora

Enjoy!