Multi screen game development in Phaser

Note: This tutorial was targeted for a previous version of the Phaser library. The updated version can be found here.

Phaser is a robust, famous multi-platform game development framework based on the fast PIXI library. It is getting much attention now-a-days. There are so much examples there in http://examples.phaser.io/, and thus learning Phaser is very simple.

First of all, thanks for the team behind this excellent library. When we consider multi-platform development, we need to think about multiple resolutions and devices. Using high quality assets in big screen devices will ensure your game will look beautifully on those. But this high quality assets will affect performance of low end devices, so we need to load the graphics for each devices separately and scale up or down the game according to the screen resolution.
Continue reading

SoundWrapper class for SoundJS

CreateJS libraries are very helpful in creating stunning html5 games and apps. This library has a SoundJS library which can be used to play sounds. It can decide which one to load according to the device capability. However, while coding games, we may need to play musics, play sound effects, stop, fade, crossfade etc. For this, we have to manually call some methods. For fading sounds we have to create a loop and reduce the volume of a sound.

Continue reading

Creating a PHP website using MVC – 4 Creating Model class

The Model class we create is the base class for all Models and it contains some common functions like getAll(), getOne(), getById(), search(), count() etc. These static methods will also be available for all other Models extending the base Model class. The model creates instances of itself for each result item for the query. i.e., if we call Book::getAll() we will get an array consisting of Book instances.

We might need to define item specific methods and properties into the classes though. In any of the inherited model classes don’t need to call any database calls directly. The model base class does this behind. When we call the method save() on an instance, it will get updated in the database and if it is not found in the database an entry is created.
Continue reading

Creating a PHP website using MVC – 3 Creating a Database Wrapper

In the previous parts of this tutorial series, we learned how to create a working example of an MVC framework, but without a Model. Now we will create a Database wrapper singleton class which can be used everywhere.

Before we create a Database wrapper, let us create an install file which installs required database, tables etc. Create a new folder in the public folder called ‘install’ and create an index.php inside. Copy this code into the file.
Continue reading

Creating a PHP website using MVC – 2 Creating the Controller and Template

In the first part of this tutorial series, we looked into how to startup the framework.  The output was displaying the controller and action of a called url. We also found which area is called – the admin or the site area.

In this tutorial, we will look into creating the Controller and Template classes.

For any class we create anywhere, we need to make sure that the filename is ended with ‘.class.php’ because this is how we defined autoloader and a class can be easily identified by just looking into the file system.
Continue reading

Creating a PHP website using MVC – 1

This is the first part of php mvc website design tutorial series. You already know what is MVC architecture and you might even know how to implement it. There is already a debate about the design of an mvc architecture. I am not going into that. The truth is whatever you think is easy, follow it. If there is Model, Controller and Views in your php application and have a consistent pattern around all things, you can suppose it to be in an MVC pattern.

Continue reading

Welcome to codetuto

Welcome to my blog. I am an Actionscript 3 game developer and a PHP Programmer. Coming straight to the point, I am not a professional blogger,  and will be posting some tutorials and views about the things I know. I am not trying to duplicate already available tutorials/posts in the internet but to post some tips on how to do some simple things that cause confusions or doubts.

Comments and suggestions are welcome. Have a nice day.