A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: not many gun game tutorials showing the actual bullet

  1. #1
    damn, im smooth drkknght's Avatar
    Join Date
    Feb 2001
    Posts
    159

    not many gun game tutorials showing the actual bullet

    still learnin, over here

    one quest i have is to create a game where you have a gun or a cannon, and some moving targets in the distance. simple enough. i've seen those tutorials, or ones like it.

    but i've never seen a tutorial explain how to animate the actual "bullet" or "canon ball" (or, in my case, we're using chickens as the bullet )

    something where you'd actually see the bullet (chicken) getting smaller and smaller and it shoots away from you.

    the fun of my game would be in the bullet animation, as well as the target practice.

    i was just wondering if there was a reason why that isn't explained much. is it significantly harder? not worth getting into?
    i'm not new to action scripting. i'm just bad at it.

  2. #2
    Senior Member
    Join Date
    Jan 2004
    Posts
    366
    well like Ihoss once said some games you wont find direct tutorial for. but you will find parts of the game in one or another tutorial. For a bullet you can probably try those space shooter tutorials, but thats if you are shooting from left to right or down to top.

    Otherwise it really is very easy, you can either make bullet a movie clip which simply gets smaller once played or make some simple script which would shrink it.
    if (fire = true)
    bullet.duplicatemovieclip("fired"+i, depth);
    fired+i.gotoandPlay(2);

    thats pseudo code, so dont copy it exactly but thats the theory.

  3. #3
    damn, im smooth drkknght's Avatar
    Join Date
    Feb 2001
    Posts
    159
    heya arrowflash!

    my idea was to have this set up, not really as a first person shooter, but with a first person view that allows you to still see the shooting character (i guess they call that 3rd person?)

    anyway, so, here's what my process would be (i think)

    1) take the "click on target to shoot it" aspects from another, existing shooter game or tutorial

    2) create a movie clip of a chicken being launched and getting smaller n'smaller

    3) then apply that code (or a code like it) to the "bullet" movie clip?
    i'm not new to action scripting. i'm just bad at it.

  4. #4
    Ihoss
    Guest
    So you see the back of your character then? And when you hit space the chicken is launched into the screen?

    Just make a bullet mc and whenver you shoot, you attach that mc. At frame one you see a big chicken, and at frame 30 you see a tiny chicken. Then tween the frames inbetween (guess where the word tween cam from ). At frame 31 there is a hitTest to see if the chicken hit anything.

  5. #5
    Well, you could do that but if it were me, I would write a shoot function that, when called, changed the bullet's (or chicken in this case ) height and width propeties as it goes, using a chicken.width-=10; and loop that code so he keeps getting smaller. That way, it isn't just animation, it's real actionscript!

    -Brcolow

  6. #6
    Ihoss
    Guest
    thats too complicated. theres no reason for doing that, except if you want it to stop shrinking or something. and the user wont know if you use AS or animation anyways.

  7. #7
    Haha, of course they won't. Just as Strille said, the user doesn't know if they are using OOP or not, it's for furture purposes BUT, if the targets are at different depths then you almost NEED to do it that way I listed.

  8. #8
    Ihoss
    Guest
    why would you need to do it that way then? depth sorting has nothing to do with the _width or _height. and since you hit the first thing you see you dont need to sort it either.

  9. #9
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,926
    Scripting that ( Using _xscale and _yscale ) is much better than using a tween, as you have a lot more control over it.

    Squize.

  10. #10
    damn, im smooth drkknght's Avatar
    Join Date
    Feb 2001
    Posts
    159
    probably for me, the less scripting, the better (easier)

    Originally posted by Ihoss
    So you see the back of your character then? And when you hit space the chicken is launched into the screen?
    sorta, yeah.

    the idea is, you see the back of a guy who is working a cannon-like contraption, that happens to launch chickens

    in the distance, there are several moving targets, that scroll left and right (like at an old-timey carnival).

    with your mouse, you click somewhere on the screen, where you want the chicken to hit. on click, the cannon fires.

    sounds easy, but because the targets are moving, and the chickens take 5 (or so) seconds to be launched and then land, the targets are difficult to hit
    i'm not new to action scripting. i'm just bad at it.

  11. #11
    Ihoss, I was not referring to depth sorting, I mean physical depth like, targets that are farther back then others. Squize pretty much confirmed what I said. I would reccomend scaling the width and height or the xscale and yscale.

  12. #12
    Senior Member
    Join Date
    Jan 2004
    Posts
    366
    like Ihoss said, tween the chicken m/c.

  13. #13
    Ihoss
    Guest
    is the canon guy rotating or moving sideways? if hes rotating then its harder. 5 seconds is a lot. its like from now...

    if you need control then yes. but if you just shot a chicken then you dont need it, do you.

    ...till now.

  14. #14
    damn, im smooth drkknght's Avatar
    Join Date
    Feb 2001
    Posts
    159
    ahh, sorry for the response delay. i got caught up trying a few different things.

    the cannon guy is basically just standing still. he'll launch the chicken just out into the distant field, on click. to save myself all the agony of lining up all the proper physics and angles of the bullets, i figured the chickens could be shot at such a high arc, that they disappear off the field of view.

    then, a few hundred yards out, when they land, they'd just be falling straight from the sky.

    ill attach the fla, if you wanna check it out.

    i found a tutorial on flashkit for a santa game, where you throw snowballs at santa claus (who is running by, right to left, very quickly). seemed very similar to what i was looking for, but when i started playing around with the code, i got all sortsa confused.

    i think i figured out the big parts.

    i mean, i have the mouse click controlling the cannon, and the pointer as, like, a target.

    i also have the targets flying by, waiting to be hit.

    i just have no chickens flyin at'em
    Attached Files Attached Files
    i'm not new to action scripting. i'm just bad at it.

  15. #15
    Ihoss
    Guest
    cool artwork

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