Skip to content

Commit

Permalink
fix animations for object layer items
Browse files Browse the repository at this point in the history
  • Loading branch information
englercj committed Oct 17, 2014
1 parent 5f17fe6 commit e4e846e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/tiled/Objectlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ Objectlayer.prototype.spawn = function (spawnCallback) {
obj;

props.tileprops = {};
props.animation = null;

// gid means a sprite from a tileset texture
if (o.gid) {
Expand All @@ -123,6 +124,7 @@ Objectlayer.prototype.spawn = function (spawnCallback) {
if (set) {
props.texture = set.getTileTexture(o.gid);
props.tileprops = set.getTileProperties(o.gid);
props.animation = set.getTileAnimations(o.gid);

// if no hitArea then use the tileset's if available
if (!props.hitArea) {
Expand Down Expand Up @@ -228,10 +230,10 @@ Objectlayer.prototype.spawn = function (spawnCallback) {
}
}

if (props.animation || props.tileprops.animation) {
if (obj.animations) {
obj.animations.play(props.animation || props.tileprops.animation);
}
if (props.animation && obj.animations) {
obj.animations.copyFrameData(props.animation.data, 0);
obj.animations.add('tile', null, props.animation.rate, true).play();
// obj.animations.play(props.animation || props.tileprops.animation);
}

if (typeof o.rotation === 'number') {
Expand Down

0 comments on commit e4e846e

Please sign in to comment.