Platform Game Question
Helllo,
I'm kind of new to as3 and programming, anyway, my problem is I have a hero character in a platform game and 3 enemies that shoot at him. When they shoot however, their bullets scroll with the movement of the hero character, when he moves they move with him. I want the enemies bullets to stay with the background that they are on and not scroll with the hero. If anyone has any idea how to help me that would be great. Here's the code that moves the enemies bullets:
//MOVE ENEMY BULLETS
public function moveEnemyBullet(k,timeDiff:uint) {
for(var i:int=enemyBullets.length-1;i>=0;i--) {
enemyBullets.x += bulletSpeed*timeDiff;
enemyBullets.y = gamelevel.y + gamelevel["enemy"+(k+1)].y-30;///-----I ADDED THIS TO TRY TO MAKE THE BULLETS STAY WITH THE ENEMY BUT IT DID NOT WORK
if ((enemyBullets.x < 0) || (enemyBullets.x > 550) || (enemyBullets.y < 0) || (enemyBullets.y > 400)) {
removeChild(enemyBullets);
delete enemyBullets;
enemyBullets.splice(i,1);
}
}
for(var j:int=enemyLeftBullets.length-1;j>=0;j--) {
enemyLeftBullets
enemyLeftBullets
if ((enemyLeftBullets
removeChild(enemyLeftBullets
delete enemyLeftBullets
enemyLeftBullets.splice(j,1);
}
}
}
If you need to see more code let me know. Thanks