Slight problem

ive got a slight problem with a bit of codeing .the code fires perfectly in the right direction and everything but the problem is, is that the bullet speeds up every time the character fires. and also i cant get the bullet to interact with anything else

**

**
onClipEvent (load) { 
   sr_bullets = 0; 
} 
onClipEvent (enterFrame) { 
   function fur(s_name:String) { 
      duplicateMovieClip(_root.sand0, s_name, _root.enemy1.getDepth()-1); 
      _root[s_name]._x = _root.char._x; 
      _root[s_name]._y = _root.char._y; 
      _root[s_name]._rotation = _root.charhelp._rotation; 
   } 
   function updat_bulle_positio(s_name:String) { 
      _root[s_name]._y -= 1*Math.cos(_root[s_name]._rotation*(Math.PI/180)); 
      _root[s_name]._x += 1*Math.sin(_root[s_name]._rotation*(Math.PI/180)); 
   } 
   i = 0; 
   while (i<=sr_bullets) { 
      updat_bulle_positio("sand" add i); 
      i++; 
   } 
   if (Key.isDown(Key.SPACE)) { 
      sr_bullets++; 
      new_sname = "sand" add sr_bullets; 
      fur(new_sname); 
   } 
   if ("sand" add sr_bullets.hitTest(_root.enemy1)) { 
      _root.enemy1.gotoAndStop(15); 
   } 
} 

the game file is at

[COLOR=#0000ff]http://www.freewebs.com/shlar/samnleogame.fla[/COLOR]

cheers

not exactly sure why your code isnt working…but i replaced all the code on that frame with the following and it sorted out the bullet speed okay (not sure what other “interaction” wasn’t working)

nr_bullets = 0;
rot = 0;

bListener = new Object();
bListener.onKeyDown = function() {
if (Key.isDown(Key.SPACE)) {
nr_bullets++;
new_bname = “bullet”+nr_bullets;
duplicateMovieClip(_root.bullet0,new_bname,nr_bullets);
_root[new_bname]._x = _root.enemy1._x;
_root[new_bname]._y = _root.enemy1._y;
_root[new_bname]._rotation = _root.enemy1._rotation;
}
}
Key.addListener(bListener);

onEnterFrame = function () {
for(i=1;i<=nr_bullets;i++){
rot = _root[“bullet”+i]._rotation;
_root[“bullet”+i]._y -= 3Math.cos(rot(Math.PI/180));
_root[“bullet”+i]._x += 3Math.sin(rot(Math.PI/180));
}
};
stop();

cheers thanks thats been a great help

ok so ive put the code into y game now and it works PERFECTLY for fireing and is a great help
but im still not sure what instance name to use to make the bullets interact with anything else
becuase ive put and litle extra code on the end to make the bullets kill the enemy but it isnt working and doin what i say
could you please just help me out. it is probably me being an idiot and using the wrong instance name so if you could just correct it i would be extreamly greatful


onClipEvent (load) {
 sr_bullets = 0;
 srot = 0;
 sListener = new Object();
}
onClipEvent (enterFrame) {
 sListener.onKeyDown = function() {
  if (Key.isDown(Key.SPACE)) {
   sr_bullets++;
   new_sname = "sand"+sr_bullets;
   duplicateMovieClip(_root.sand0, new_sname, sr_bullets);
   _root[new_sname]._x = _root.char._x;
   _root[new_sname]._y = _root.char._y;
   _root[new_sname]._rotation = _root.charhelp._rotation;
  }
 };
 Key.addListener(sListener);
 onEnterFrame = function () {
  for (i=1; i<=sr_bullets; i++) {
   srot = _root["sand"+i]._rotation;
   _root["sand"+i]._y -= 10*Math.cos(srot*(Math.PI/180));
   _root["sand"+i]._x += 10*Math.sin(srot*(Math.PI/180));
  }
[COLOR=red]  if [COLOR=black](_root[/COLOR]["[COLOR=blue]sand[/COLOR]"+[COLOR=yellowgreen]i[/COLOR]].[COLOR=royalblue]hitTest[/COLOR][COLOR=black](_root[/COLOR].[COLOR=darkorange]enemy1[/COLOR][COLOR=black]))[/COLOR] {
  [COLOR=black] _root[/COLOR]["[COLOR=blue]sand[/COLOR]"+[COLOR=yellowgreen]i[/COLOR]]._x = 7484928;
  [COLOR=black] _root[/COLOR]["[COLOR=blue]sand[/COLOR]"+[COLOR=yellowgreen]i[/COLOR]]._y = 2749284;
   [COLOR=lime][COLOR=black]_root[/COLOR].[COLOR=sandybrown]enemy1[/COLOR].[COLOR=black]gotoAndStop[/COLOR]([COLOR=black]15[/COLOR]);[/COLOR]
   [COLOR=black]_root[/COLOR].[COLOR=sandybrown]score[/COLOR] [COLOR=black]= _root.[/COLOR][COLOR=sandybrown]score[/COLOR][COLOR=black]+10[/COLOR];
 [/COLOR][COLOR=black] [/COLOR][COLOR=red]}
[/COLOR] };
}

actually no worries ive worked it out

THANKS for all of your help