Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well ... if I may say so, this code looks quite wrong. Either something is missing from the code or this code will never make the bullets fly.</p> <p>First off, you can set x and y of the new bullet directly (replace everything after "orientate this bullet from players body" with this):</p> <pre><code>tmpBulletId.x = Object(root).localSurvivor.x; tmpBulletId.y = Object(root).localSurvivor.y; </code></pre> <p>Perhaps this already helps, but your code there should already do the same.</p> <p>But to let these bullets fly into any direction, you also need to add an event listener, like so:</p> <pre><code>tmpBulletId.addEventListener(Event.ENTER_FRAME, moveBullet); function moveBullet(e:Event) { var movedBullet:MovieClip = MovieClip(e.currentTarget); if (movedBullet.x &lt; 0 || movedBullet.x &gt; movedBullet.stage.width || movedBullet.y &lt; 0 || movedBullet.y &gt; movedBullet.stage.height) { // remove move listener, because the bullet moved out of stage movedBullet.removeEventListener(Event.ENTER_FRAME); } // remove the comment (the //) from the line that you need MovieClip(e.currentTarget).x += 1; // move right // MovieClip(e.currentTarget).y -= 1; // move up // MovieClip(e.currentTarget).x -= 1; // move left // MovieClip(e.currentTarget).y += 1; // move down } </code></pre> <p>This example lets your bullet fly to the right. If you need it flying into another direction, just comment out the line with the "move right" comment and uncomment one of the other lines.</p> <p>This is of course a very simple example, but it should get you started.</p> <p>I hope this helps, and that my answer is not the wrong answer to the question.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload