Migration from gameQuery 0.5.x to 0.6.x

This small guide will help you migrate you code to gameQuery 0.6.x.

Moving sprites around

This is the biggest change in this release and it affect the way you move elements around. You now have dedicated functions to move and resize sprites, groups and tile-map. They are many reason for this:

However this comes with a price: from now on you CANNOT use the .css() function to manipulate any gameQuery generated object without risking to break something.

gameQuery 0.5.x
$(“#mySprite”).css(“left”, parseInt($(“#mySprite”).css(“left”))+10) .css(“top”, 300);
gameQuery 0.6.x
$(“#mySprite”) .x(10, true) .y(300);

The changes you have to do in your code are not easily automatized. You have to look at each call to .css() and wonder if it modifies a gQ object, if it does then you have to choose the correct function to replace it. Keep in mind that if you want to increment the coordinate you don’t have to explicitly lookup the property you want to change: you can use the “true” flag like shown in the example to make the change relatif.


This function was deprecated in 0.5 and is now gone for good. You can use the example bellow to simple replace it. If you used a callback as third argument you can modify it to change the loading bar size and passe it to the new function.

gameQuery 0.5.x
$().setLoadBar(“#myLoadBar”, 400);
gameQuery 0.6.x
$.loadCallback(function(percent){ $(“#loadingBar”).width(400*percent); });

Other changes

The other changes in 0.6 are all new functionality so you should really take a look at the release note and the API documentation to learn more about them. They shouldn’t impact existing code in any ways.

Fork me on GitHub