onaluf / gameQuery

a javascript game engine with jQuery
http://gamequeryjs.com
633 stars 161 forks source link

Player or Enemies without spriteAnimation, how to change imageURL #24

Closed Nastrok closed 10 years ago

Nastrok commented 10 years ago

Hi,

First, sorry for my english language.

I have one "enemie" like that :

var enemie_1 = new $.gQ.Animation({imageURL: "img/angryhuman_face.png"}); $('#tilemap').addSprite("enemie_1",{animation: enemie_1, height:48, width:48, posx:480, posy:96});

I wanted to ask you if it is possible to change that ' imageURL: "img/angryhuman_face.png" ', in the registerCallback function.

My "enemie" haven't animation, just 4 states : face, back, left, right.

Thanks to clarify me on this point.

Have a nice day

Nastrok commented 10 years ago

Furthermore, in Internet explorer 10, i think my playground isn't load.

Indeed, in the development tools of Chrome or Firefox, the div which have for id "gQ_scenegraph" have "visibility : visible" for style attribut. In IE 10, this style attribut is on "hidden", all the elements (tiles and players) are present in gQ_scenegraph.

I don't know what is the probleme, if i just define the playground and tiles, nothing is display.

Nastrok commented 10 years ago

IE10 issue resolved,

Even if you haven't anything to put in
var animations = new $.gQ.Animation({ }); you have to put a picture.

onaluf commented 10 years ago

Hi,

In general Animation are expected to have at least an image defined. However you are not forced to assign an Animation to a Sprite. If you don't, it will simply be transparent (collision detection will still occur).

If you want to change the image like you describe in the first question you can simple define two Animation object and use setAnimation to switch between each of them. Animation are very lightweight object so you shouldn't worry about creating a lot of them.

The name is slightly misleading but Animation can also be static images).

If you have more questions please use the forum (http://forum.gamequeryjs.com) gitHub is only for bugs.

Nastrok commented 10 years ago

Merci beaucoup Selim.

Je n'avais pas bien compris les setAnimation avant de créer et d'ajouter les sprites a la tilemap.

Bonne continuation.

2013/11/29 Selim Arsever notifications@github.com

Hi,

In general Animation are expected to have at least an image defined. However you are not forced to assign an Animation to a Sprite. If you don't, it will simply be transparent (collision detection will still occur).

If you want to change the image like you describe in the first question you can simple define two Animation object and use setAnimation to switch between each of them. Animation are very lightweight object so you shouldn't worry about creating a lot of them.

The name is slightly misleading but Animation can also be static images).

If you have more questions please use the forum ( http://forum.gamequeryjs.com) gitHub is only for bugs.

— Reply to this email directly or view it on GitHubhttps://github.com/onaluf/gameQuery/issues/24#issuecomment-29518257 .