Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

Results 1 to 5 of 5

Thread: gun shooting

  1. #1

    gun shooting

    I have go a gun that looks like it shoots but no bullets come out of the gun. I dont know how to do this and I am sort of new to flash. Could you please fill in any missing code and anything else you want on the attached file. Any help on this would be gr8. cheers
    Attached Files Attached Files

  2. #2
    Man you are really a beginner! If i were to help you i would be better of making something from scratch than using your example!But i am currently busy with my exams, so i am just gonna give some tips now

    1)your bullet depletion code is the silliest i have seen so far...onClipEvent(enterFrame){} executes all the code in the braces every game loop...that is everytime the playhead reads that frame. So if you have multiple statements put them in one enterFrame function only:
    Code:
    onClipEvent(enterFrame)
    {
     if(condition1)
       statement
     else if(condition2)
       statement
    ...
    ...
    }
    but a game designer isn't a spriter, he should be more of a programmer, and as a programmer you should find the shortest and most flexible route available to you. For example, the above scenario can be minimised as:
    Code:
    onClipEvent(enterFrame)
    {
     for(i=50;i>0;i--) //i starts at 50, and as long as it is greater than 50, lower it by 1
      {
       if(ammo==i)
         _root.bullets.gotoAndStop(50-i) //so if, say you have 45 ammo, it will stop at 50-45=5th frame!!
      }
    }
    2)Your main problem is however, that you cant use attachMovie() properly! Your bullet depletion should have been done with attachMovie, and removeMovieClip() and not with a 50 frame animation, since code gives you greater flexibility than animation! Anyway, the same attachMovie is again required to actually fire a bullet, but rather than stating it here, search google for examples on it....you will learn faster!


    if you have problems understanding something, feel free to ask me!
    MY BLOG

    I need a SPRITER who can do pixel arts for an arcade fighter project. If you can help out, please pm me.
    I also need someone who can write simple xml files.


  3. #3
    thanks for the help. I did say that i was new to flash Could you make me a quick gun that turns and add a bullet so I can understand it better plz (I will start from scratch dont worry)

  4. #4
    As i said earlier, i am a bit busy now with my exam, so i cant really help you, but heres a very nice example that, if you can understand, will teach you a lot of things:

    http://www.emanueleferonato.com/2008...oons-tutorial/
    MY BLOG

    I need a SPRITER who can do pixel arts for an arcade fighter project. If you can help out, please pm me.
    I also need someone who can write simple xml files.


  5. #5
    thank you very much you have been a good help and good luck with ur exams

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012