Sha256: 4d52d4fbb00d2f2e4441a36603a53cf36c380ef654f4b79080e4a7182e7a1094

Contents?: true

Size: 585 Bytes

Versions: 4

Compression:

Stored size: 585 Bytes

Contents

re.c('item')
.requires('tsprite update hit items.png')
.namespaces({
  
  update:function(t){
		
		if(this.hero.hitBody(this.posX, this.posY, this.sizeX, this.sizeY, 10, 0)){
			this.touching = true;
			this.touch(t);
			
		} else if(this.touching){
			
			this.touching = false;
			
			this.untouch(t);
		}
		
	}
  
})
.defaults({
  touching:false,
  
  touch:function(){
    
  },
  
  untouch:function(){
    
  }
})
.init(function(){
  this.hero = re('hero')[0];
  
  this.on('update', this.item_update);
  
  this.updateBefore(this.hero);
})
.dispose(function(){
  this.off();
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
entityjs-0.4.0 templates/platform/scripts/items/item.js
entityjs-0.3.2 templates/platform/scripts/items/item.js
entityjs-0.3.1 templates/platform/scripts/items/item.js
entityjs-0.3.0 templates/platform/scripts/items/item.js