A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Bullet firing

  1. #1
    Junior Member
    Join Date
    Mar 2008
    Posts
    13

    Bullet firing

    bullet firing mechanisms problem

    Ok, I am going to do a bit of a side project until my lazy friend gets over here to work on the starship game. So, it's a simple stick figure side scrolling game. You have a character on the left, you have smaller people coming from the right. You ned to shoot them in order to make them go away. Yet they shoot back at you. so here's my questions:

    1. How to get the bullet to fire from your character's gun when you press a button? i tried the tutorial but it didn't work for MX.

    2, to get the enemies to fire at random, how would I go abot this.

    Thanks in advance!
    Later,
    FF

  2. #2
    Senior Member
    Join Date
    Jan 2001
    Location
    IT
    Posts
    213
    Well about your character firing when you press a button, I'd use a Mouse.listener, here it is a hint, (it'd probably better if you'll have a look in your flash help as well).

    // Create a mouse listener object
    var mouseListener:Object = new Object();


    // When you click the mouse, call fire function
    mouseListener.onMouseDown = function() {
    fire()
    };
    Mouse.addListener(mouseListener);

    Hope it helps
    Giano

  3. #3
    Junior Member
    Join Date
    Mar 2008
    Posts
    13
    Ok, I got it 'bout fixed up. I looked at the help (like you said) and wham, there it was. now another question. I want a bit of a tracer effect coming off the end of my bullet graphic. Not the animation. Is there a way that I can give a certains object a sort of "death rate" or something? so that the tracing material automatically goes away, yet looks natural.

  4. #4
    Senior Member
    Join Date
    Jan 2001
    Location
    IT
    Posts
    213
    hmm you're talking about a trail effect. Well you might have a look into the tutorials or movie section of the site. Mainly they're used on mouse movement, but with some modification you can easy customize it to your needs.
    Here it's a tutorial to start with:

    http://www.flashkit.com/tutorials/Ac...-846/index.php

    hope it helps

  5. #5
    Junior Member
    Join Date
    Mar 2008
    Posts
    13
    Thanks Giano! I see that trail effect in FlashKit's version of pong. The ball has a trail. Ok, I'll check out the tutorial. Thanks again!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center