Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contribution to the gamequery #13

Open
jarodium opened this issue Apr 7, 2012 · 1 comment
Open

Contribution to the gamequery #13

jarodium opened this issue Apr 7, 2012 · 1 comment

Comments

@jarodium
Copy link

jarodium commented Apr 7, 2012

Hello selim

I would like to contribute some code to gamequery. Maybe it is not the time but I hope you find it useful for the tilemap editor tool.

Here is the code

var templ_dir = "BASE SITE DIRECTORY";
var templ_imgs = templ_dir+"SPRITE DIRECTORY";
var sprDelta = 32; //default sprite delta ( for use on tilemap, since all animations have the same delta )
var animations = [];

//this sets up a simple sprite into the animations array
function setupSprite(image,offsetx,offsety) {
animations.push(new $.gameQuery.Animation({
imageURL: templ_imgs+image,
type: $.gameQuery.ANIMATION_ONCE,
numberOfFrame: 1,
delta: sprDelta,
rate: 30,
offsetx: offsetx,
offsety: offsety
}));

}

//this allows to setup a building matrix on the animations array
function setupSpriteBuilding(image,startX,startY) {
//this needs some work, because this assumes that the building is composed by 9 tiles, on a 3 rows and 2 colums
//anyway the buildings can be organized in various layouts in the spritesheet.
for(i=0;i<2; i++) {
for(j=0; j<3; j++) {
setupSprite(image,startX+(sprDelta_j),startY+(sprDelta_i));
}
}
}

you call'em like this:

setupSprite('TileA5.png',0,32);
setupSprite('TileA5.png',0,64);

setupSpriteBuilding('edificios.png',192,64);

I'm working on how to make map placement easier, but i'll get there as soon as I can.

Best regards
jarodium

@Munsio
Copy link

Munsio commented Jan 16, 2014

Hey there,

At first, thanks for such a great DOM based game Framework.

I made a little Timer plugin you can find it here:
https://github.com/MrTool/gameQuery-plugins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants