Saturday 1 October 2016

Make a Mario-Style Platformer with the Phaser Editor

I been busy plugging away at making some html5 games using the incredible phaser framework as I wrote before about and the incredible Phaser Editor

One thing I love that they just added to the phaser editor is the scene creator which makes life so much easier to create a whole scene with drag and drop and resize abilitlies.

Anyone who has created games before know how much of a headache all the measuring can be, where to place objects (me I use gimp for most of my measuring a scene with, then write down all the x and y placements into  text file editor the paste them over or keep the editor and gimp open at the same time in different workspaces (I use linux of course)
This can be a headache and time consuming.

Well Arian (the developer for the Phaser editor) added a scene maker which gets rid of this headache, just drop the sprites into the scene and change them resize them etc it does it all right inside the editor now.
An extremely useful add on

Here is an image of the scene maker






He wrote an excellent tutorial on how to use this which you can check out here:

https://gamedevacademy.org/make-a-mario-style-platformer-with-the-phaser-editor/

If you want to try out the editor you can download it here:

http://phasereditor.boniatillo.com/

You want to make html5 games then this will make your life a whole lot easier, I been using it for quite a while now and it has saved me hours of coding and texture atlas which is also built in, a totally complete built in game maker.

I highly recommend this to anyone thinking of getting into creating html5 games or anyone who is making them now.

Back to creating my games :)
Sam

Thursday 2 June 2016

Brokeh MDM theme created with phaser editor

I just finished a new mdm theme
I decided to go real boring this time around and make a simple and clean brokeh animated theme for those who like brokeh
Not me but I know a lot do so it's for you  :wink:

You can check it out here: http://samriggs.deviantart.com/art/Brokeh-MDM-theme-for-linux-made-with-phaser-editor-612911644
Here is a image of it






If you want to see it in action here it is






and ya can gather the tar install files or all the files to check out or to fork at github

https://github.com/samsstuff/Bokeh-MDM-Theme

I am putting all the new themes on github from now because it is just easier for me and you

Enjoy
Sam

Saturday 7 May 2016

Area51 MDM theme made with phaser editor

Well I finally got some time together to make my login theme and try some other stuff with the phaser editor.

I always wanted to make my computer into a whole area 51 theme from login screen on through to everything else including the icons.
I'll get to the rest later but I got the mdm theme completed.
This should show you some more what you can do using the phaser framework for mdm themes and again I'll give you the link to get the editor which has everything built in and is linux friendly.
http://phasereditor.boniatillo.com/
For those who want to make their own or want to get into html5 gaming, it's a great editor.

Here is the screenshot of it.






It has a gnu and tux in tubes floating around with bubbles to represent gnu/linux

You can download it here: http://samriggs.deviantart.com/art/Area51-MDM-Theme-create-with-phaser-editor-607619934

I also put the tar.gz install file plus all the files on github now which might be easier for you.


Here is a video of it in action



Hope you enjoy it.

Sam

Friday 1 April 2016

MDM Theme created with Phaser Framework and Phaser Editor


MDM Theme created with Phaser Framework and Phaser Editor

I decided to try something completely different and wanted to for awhile now.
I decided to switch from java and opengl for android and try html5 instead.
After much research I decided to use phaser html5 framework.
I then wanted a IDE to code it in, after trying a few (XDK, Sublime and a few others) I decided to give the phaser editor editor a go and decided to use it over all the rest.
Main reason, I am used to eclipse and from working with libgdx it was similar for me.
Plus it has a nice texture packer and assets loader built in which saves a ton of time and it creates the json files to go with it which is easily called for in the code.

Enough of the reasons why, I always wanted to try a gaming framework as the background for mdm themes and decided to give a go.
There was always an issue with canvas and mdm so I sceptical so I threw a 5 minute sample together threw it into the login screen, logged out and crossed my fingers and hoped for the best.
Well to my surprise it worked great, the canvas loaded and ran perfect.

So why use a gaming framing for mdm?
Well it gives you tons more options to create really nice animated login screens, not just basic css animations but all out full blown animations.
Box2d, P2 physics, particles, tweens, animations etc etc etc.
Pretty much anything that can be done in a normal game animation can be done.

So I decided to come up with a quick tutorial to anyone started making them with phaser framework and the phaser editor.

To you started first get the editor here: http://phasereditor.boniatillo.com/blog/
It is free with a nag screen but fully functional, if you use it for your work please donate as it is well worth it.
Drop it into your home directly (it is a standalone version no install necessary), and open it up.
You can start a new project by following the tutorial on the phaser editor site

Use basic.

Now what I did was just use one file for the whole sample I presented here since it was a one page animation but you can make it as detailed as you wish.

I just used the Main.js file to create the whole animation.

All the files I use in this sample plus the base mdm theme files can be downloaded here
http://samriggs.deviantart.com/art/MDM-Theme-created-with-Phaser-Framework-and-Phaser-600449516

First I deleted all the sample stuff (images, other javascript files in the js folder) I kept only the Main.js and assets-pack.json which I changed later to load my atlas and background image.

If you walk through these two tutorials it will teach you how to add images to the texture packer here

and the assets load tutorial here

I don't see any need in rewriting these tutorials here as it is done great on the website tutorial.
The object of the quick tutorial is only to show you how to bring in the created animation into mdm itself.

Here is the main.js code I wrote for this sample.


window.onload = function() {
// Create your Phaser game and inject it into an auto-created canvas.
// We did it in a window.onload event, but you can do it anywhere (requireJS
// load, anonymous function, jQuery dom ready, - whatever floats your boat)
//var game = new Phaser.Game(1920, 1080, Phaser.CANVAS, '');
var game = new Phaser.Game(1920, 1080, Phaser.CANVAS, '', { init: init, preload: preload, create: create, update: update, render: render });
function init() {
game.input.maxPointers = 1;

// Setup the scale strategy
game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
//you can try resiz to see which one fits best show_all scales nicely
//but might show letterbox
//this.scale.scaleMode = Phaser.ScaleManager.RESIZE;
game.scale.pageAlignHorizontally = true;
game.scale.pageAlignVertically = true;
}
function preload() {
game.load.pack("level", "assets/assets-pack.json");
}
var meteor1;
var meteor2;
var meteor3;
var meteor4;
var meteor5;
var movex = 0;
var movey = 300;
function create() {
this.add.image(0,0,"background");
this.add.image(1060,120,"myatlas","planet");
meteor1 = this.add.sprite(movex,movey,"myatlas","rock7");
game.physics.enable(meteor1, Phaser.Physics.ARCADE);
meteor2 = this.add.sprite(movex - 100,movey + 300,"myatlas","rock8");
game.physics.enable(meteor2, Phaser.Physics.ARCADE);
meteor3 = this.add.sprite(movex + 100,movey + 200,"myatlas","rock9");
game.physics.enable(meteor3, Phaser.Physics.ARCADE);
meteor4 = this.add.sprite(movex + 400,movey + 150,"myatlas","rock5");
game.physics.enable(meteor4, Phaser.Physics.ARCADE);
meteor5 = this.add.sprite(movex + 700,movey + 100,"myatlas","rock6");
game.physics.enable(meteor5, Phaser.Physics.ARCADE);
}
function update() {
meteor1.angle += .1;
meteor1.body.velocity.x=100;
if(meteor1.x > 2500){
meteor1.x = -150;
}
meteor2.angle += .2;
meteor2.body.velocity.x=120;
if(meteor2.x > 2500){
meteor2.x = -200;
}
meteor3.angle += .3;
meteor3.body.velocity.x=140;
if(meteor3.x > 2800){
meteor3.x = -250;
}
meteor4.angle += .4;
meteor4.body.velocity.x=180;
if(meteor4.x > 2700){
meteor4.x = -200;
}
meteor5.angle += .6;
meteor5.body.velocity.x=170;
if(meteor5.x > 2900){
meteor5.x = -220;
}
}
function render() {
//you can add debug stuff here for testing
// game.debug.spriteInfo(s, 20, 32);

}
};

I decided to use the screen size of 1920x1080 for my image size, you can make it whatever you want.
Phaser has a nice scale manager with quite a few options, I was going to use RESIZE but after testing I opted for SHOW_ALL
This resizes or sizes the screen once loaded in the window.

game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;

You can check out the scale manager for phaser here

The preloader:
function preload() {
game.load.pack("level", "assets/assets-pack.json");
}
This will load all the images in the assets loader json file that the editor created (all the texture packer json is in this also so it's all in one neat file and can be loaded from this one file.

Here is an image of the texture packer:



Here is an image of the assets loader




Alright then, once you made your creation and are satisfied with it, it is time to bring it on over the your mdm template folder.
Go into your directory where you saved the game files you created and then into the WebContent folder.
Choose all files in this folder except the index.html file, leave that one out.
Copy paste them into your mdm theme folder like below.


Now that your creation is in the folder we need to add the javascript into the head tags of the main index.html file in the mdm folder that runs the mdm files.

Go into your phaser creation in the webcontent folder again where you just copied all those files over from and open up the index.html file and copy the javascript links and paste them into the mdm index.html like below



now that that is done save your mdm index.html file and close it. 

Next change the name in the theme.info file to what you named it (it should be the same name as the folder that holds all these files) like the image below.


Save it and close it.
Now it's time to test out your creation and hopefully it works.
Load the mdm emulator, in linux mint you type in 
mdm-theme-emulator
into your terminal as in the image below


This loads the emulator click on open and find your mdm index.html file and open it, this will load your newly created mdm/phaser theme so you can check it out like below.


volia it works, you can test it here before going live. 
While your at it take a screenshot of this because you need it for your screenshot file in the mdm folder.

Bring in that screenshot into gimp or your program of choice.


Crop around the emulator and open the screenshot.jpg file into gimp also under a new file. Paste this huge image over and select the layer in gimp and under layer resize it to fit the screenshot size so it ffits the same size as below


Some cropping might occur and overwrite the file so it saves your new screenshot and close the mighty gimp.

Now you are ready to go live.

Select the folder that holds your mdm creation, right click --> compress
compress it as a tar.gz as in the image below


Now that you have that done you can go live if you like, go to settings the click on the login window as in the image below


It will ask you for your password, once it opens just drag your tar.gz into the window and install it as in the image below


Select it and next time you log in your ready to see your new mdm login screen.

I included the base mdm file you'll need in the download along with my sample.
Just add your own phaser creation and replace the files I added and your ready to roll.
If you want to learn more about phaser and learn how to make some cool effects and animations they have a ton of examples and you can also download the master file that has tons of examples in it for you to play with.
The site has tons of tutorials to teach you all you'll need to know.
You can check out the examples here

Here is a short video of it in action in the emulator




Happy coding.
Sam


Edit: thanks to MegMut over at the phaser forums http://www.html5gamedevs.com/topic/21659-phaser-tutorial-for-linux-mdm/

I am adding the random code  MegMut added if you wanted to use this mdm yourself or just to use the random part on your own.


Here it is from MegMut:

"I took a good look at your code, and I think I've been able to tweak the performance. There isn't any need to enable the physics engine, as all you're doing is moving the sprites body, also, I went and made it a little bit more dynamic. I hope you don't mind ;) Here's the code :)
create() {
 // create the meteor group
 this.meteorGroup = this.game.add.group;
 this.rocks = [5, 6, 7, 8, 9];
 this.numOfMeteors = 5

 for (var i = 0, i <= this.numOfMeteors; i++) {
  // generate random x value between -150 and the games width
  var x = this.game.rnd.integerInRange(-150, this.game.width);
  var y = this.game.rnd.integerInRange(0, this.game.height);
  // pick a random rock from the rocks array 
  var rock = this.rocks[Math.floor(Math.random()*this.rocks.length)];
  // create the sprite
  var meteor = this.game.add.sprite(x, y, "myatlas","rock8")
  // pick a random speed for the meteor to travel at
  meteor.speed = this.game.rnd.integerInRange(200, 250);
  // pick a rancom spin for the meteor
  meteor.spin = this.game.rnd.integerInRange(-3, 4);
  this.meteorGroup.add(meteor);
 }
}

update() {
 for (var i = 0; i < this.meteorGroup.children.length; i++) {
  this.meteorGroup.children[i].x += this.meteorGroup.children[i].speed;
  this.meteorGrou.children[i].angle += this.meteorGroup.children[i].spin;
  // use world wrap to allow the sprites to go off on side, and continue back on the other
  this.game.world.wrap(this.meteorGroup.children[i], this.meteorGroup.children[i].width, false, true, true);
  // alternativly, set start and x positions for the sprites individually and perform a check on every update loop
 }
}


it will allow you to create as many meteors as you want by changing one variable. It also randomsies a lot of the positional data, meaning every time you go the login screen, it will never look the same. The only thing I've not tried before, is the world.wrap function. I checked the docs and that should work fine, but if it's an issue, you can just do what the button commend of the update loop says"

Thanks MegMut :)



Monday 28 March 2016

HTML5 Games on the way

Well time for a change. I decided to try my hand at html5 games and apps. Why the change? well I been debating lately whether or not to try making games in html5 since that is the way things seem to flowing these days. It is quicker and easier to code, although going from java down to javascript is a tiny learning curve on what will not work and what will work. Limit on artwork on android limits what can be done with java where as html5 there really is no limit except slowing things down with to much going on at the same time but it is not limited to 1.6 MB at a time or close to that. I can make it any size I want if web based and make it fullscreen or a certain size with the option to go full screen. Keeping users positions and stats in a database hosted on a site opens more doors. Sockets for multiplayer games for web based games. If so desired it can also be ported to phones and tablets as well The list can go and on and I know there can be a debate about it, which I do not wish to go into. Anyhow this is what I'll be working on for awhile and maybe permanently if all goes as expected. Will I still be making android apps? Yup probably so, this just allows me to branch out in areas I always wanted to go.
 After much research and studying I decided to use phaser (soon to be laser) framework. It just works for me so far.
You can check it out here
I tried a few IDE's including sublime and XDK but decided to choose phaser editor as main IDE for html5 games.
Main reasons It just works, it has eclipse as it's base and it is well put together to work with phaser and work much like libgdx does in some aspects so I'm comfortable with that fact.
You can check out the editor here
Also it is LINUX friendly :) here is an image of the phaser editor

 

 It should be a fun journey I'll keep you updated as games progress.

Just to give a quick taste of the first html5 game I am working here is a screenshot.


I won't say what this game is going to be until finished but it is one of my wifes favorite style of game.
The artwork will probably take me longer then the coding but I'll add a post once finished and where to play it, this is just the first level screen (not complete obviously) So there is a longggg way to go yet.
For those curious what programs I work in for to create the art it is my two favorite, gimp and krita, krita for the more painting (blue section) gimp for the layouts and less painting areas (framing, vines etc).
I have to re-teach  myself php and mysql for backend stuff before putting it up (I haven't worked in either since my flash/php tech review days in the early 2000's) but it shouldn't take me to long to refresh my old brain and catch up on new stuff that came down the pipeline since php4.

Also I want to try and use phaser and the phaser editor to create some animated mdm themes for linux, not sure if it will work but hopefully it will, I had some issues in the past using canvas with mdm but maybe this will work.
I'll keep you updated on that experiment because if this works there is a great potential to make some amazing login screens for linux and maybe some animated screensavers as well for linux.
Sam

Monday 10 November 2014

Pet Duck

Thought I would share this video taken in 2010
I reuploaded it as I had to rotate it, just a nice break.
This was a duck that followed me into my wifes store so we had to get him over to the park so he wouldn't get run over or any harm to him.
This little guy made me want a pet duck.


Just a little breather inbetween me making games and fond memories when I lived in B.C.
Enjoy.
Sam

Wednesday 24 April 2013





Linux Mint now has html5 coming for the new mdm.
This got my curiosity  up since I like making things that move around a screen, so I decided to make some animated mdm themes for the Linux Mint new mdm.
You can check out all the themes I made here: http://samriggs.deviantart.com/gallery/

Now to get this working on your Linux Mint machine there is instructions and a download to install and how to get it up and running go here: http://blog.linuxmint.com/?p=2327

There is also a thread on the Linux Mint Forum to keep you updated on more themes and updates and just general new mdm stuff here: http://forums.linuxmint.com/viewtopic.php?f=25&t=126979

This is a fascinating new twist on the mdm login screen allowing us to make pretty much anything that can be created in html5 for the login screen.
Another great move for linux mint.
Sam