Sha256: ffe85470c718f3aadf24972e83cca879262eb5eeef931ed993db364165a96219

Contents?: true

Size: 811 Bytes

Versions: 8

Compression:

Stored size: 811 Bytes

Contents

describe('hitmap', function(){
	
	var e;

	beforeEach(function(){
		e = re.e('hitmap');
	});

	it('checkHit', function(){
		
    //setup re.tile
    
    //check hit on blank map
    var k = e.checkHit(0, 0, 10, 10, 10, 10, 0, 0);
    
    is(k)
    
    //pos should be vel + pos
    eq(k.posX, 10)
    eq(k.posY, 10)
    
	});
  
  it('should hit wall', function(){
    re.tile.sizeX = 25;
    re.tile.sizeY = 25;
    
    var posX = 0;
    var posY = 0;
    var velX = 40;
    var velY = 0;
    var bodX = 25;
    var bodY = 25;
    
    //setup hit block
    e.automap(1, 0, e.hitValue);
    
    var res = e.checkHit(posX, posY, velX, velY, bodX, bodY, 0, 0);
    
    ok(res.hitX);
    is(res.tarX)
    is(res.tarY)
    
  })
  
  it('has automap', function(){
    
    e.automap(0,0,1);
    
  })
  
});

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
entityjs-0.4.4 spec/javascripts/src/math/hitmap_spec.js
entityjs-0.4.3 spec/javascripts/src/math/hitmap_spec.js
entityjs-0.4.2 spec/javascripts/src/math/hitmap_spec.js
entityjs-0.4.1 spec/javascripts/src/math/hitmap_spec.js
entityjs-0.4.0 spec/javascripts/src/math/hitmap_spec.js
entityjs-0.3.2 spec/javascripts/src/math/hitmap_spec.js
entityjs-0.3.1 spec/javascripts/src/math/hitmap_spec.js
entityjs-0.3.0 spec/javascripts/src/math/hitmap_spec.js