All pastes #2053920 Raw Edit

Anonymous

public text v1 · immutable
#2053920 ·published 2011-05-04 18:40 UTC
rendered paste body

  LOOP THROUGH ALL BULLETS IN THE GAME UPDATE  { 

var radAngle : Number = projectiles.getItemAt(x).angle * (Math.PI /180);
 
projectiles.getItemAt(x).bullet.velocity.x = Math.cos(radAngle) * 150;
projectiles.getItemAt(x).bullet.velocity.y = Math.sin(radAngle) * 150;
									
var workedx:uint = Math.round((projectiles.getItemAt(x).bullet.x-2) / FlxG.width*40);
var workedy:uint = Math.round((projectiles.getItemAt(x).bullet.y - 4) / (240) * 30 );

if (level.getTile(workedx, workedy) != 0) 
  {
  //bounce the bullet off the wall???!
if ( projectiles.getItemAt(x).angle > 0 ) { projectiles.getItemAt(x).angle = -projectiles.getItemAt(x).angle; }
if ( projectiles.getItemAt(x).angle < 0 ) { projectiles.getItemAt(x).angle = projectiles.getItemAt(x).angle; }
	
  } 
}