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 9 of 9

Thread: A couple semi-basic programming questions (AS2)

  1. #1

    A couple semi-basic programming questions (AS2)

    Hey everyone, wassup!

    I'm currently working on a not-extremely-complicated game project, and I just have some pretty basic questions about what code I need and if it exists. So instead of making like 3 different topics about it, I'm putting them all in here. What I need to do is the following:

    1) Count the number of frames that have passed. (Being used for attack animations)
    2) Identify the name of an object that has been hit using hitTest (Used for multiplayer & multicharacter combat)
    3) Putting multiple platforms in the same instance (For...well...levels with multiple platforms)

    There are going to be plenty of characters and plenty of attacks, so finding a simple way to do these would eliminate a lot of headache. I'm pretty sure there's a simple command to do both of these, I just don't know what they are. Otherwise, any advice you can give would suffice.

    Any help is greatly appreciated. Thanks in advance

    Bolshoi
    Last edited by Bolshoi333; August 1st, 2008 at 04:41 AM.

  2. #2
    Actually, i don't think theres that much of a simple way to do this....
    To find the number of frames that have passed you need to implement a counter to keep track of the frames.
    For hitTest you cannot return the "other" object directly, however theres a excellent guide about multiple collisions on the main site.
    Well that is easy, just attach multiple instances on the stage, search for attachMovie() if you want!
    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
    My hope was to put each level in its own movie clip and just attach the whole thing into the stage at once. Is there any way to do that and not have the character hitTesting in mid air?

    And what exactly would a frame counter look like?
    Last edited by Bolshoi333; August 1st, 2008 at 06:10 AM.

  4. #4
    why not? just test for instances inside the movieclip! You should really read the tonypa's tutorials, and the the platform game tutorial on the main site....you will get answers to almost all of your beginning questions!
    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
    hi

    1) Isn't there a property named "_currentFrame" from MovieClip ? which returns the number of the frame ?
    2) AS bluemagica said, by using the hitTest function, you need to strictly name the object which would be looking for.. so no auto testing possibility. you can also try to put all ennemis in a target clip, and hitTest it with the player. When a collision appears, just make a loop on all ennemis's clip to find the right one.
    3) attachMovie, yes. ( clip.platforms, where 'clip' is a container)

  6. #6
    Alright, I'll need to process all this, and hopefully come out with something that works.

    Thanks for the help guys!

  7. #7
    Ok, we'd be glad to see your work !

  8. #8
    Quote Originally Posted by Dj_ouf View Post
    2) AS bluemagica said, by using the hitTest function, you need to strictly name the object which would be looking for.. so no auto testing possibility. you can also try to put all ennemis in a target clip, and hitTest it with the player. When a collision appears, just make a loop on all ennemis's clip to find the right one.
    You could, for example, put a bunch of objects in an array and test one object against one/all object(s) in the array. In that case, you wouldn't be strictly naming the object stored in the array. Otherwise, yeah, you can't blindly test if an object is hitting ANYTHING without using some sort of technique to analyze what 'anything' is.
    you = function(){
    setEnabled( true );
    live();
    setEnabled( false );
    }

  9. #9
    in my game i used a "applyGravity" function which calculated the gravity for any object which calls it AND
    adds it's instance to an array(if it wasn't added yet)

    then in the first frame of my platform i called the "makeStatic" function

    the makeStatic look for everbody in the array and check for collision...
    if hit it calcs the object position to see where is the object coming from,
    so I could make the platform act like both ground, walls and ceiling.

    "A human can interpret missing logic but a computer can't." - wkt
    "That goes into the 'too bad' box." - TOdorus
    "This is a three year old thread, there's no reason to post here..." - flyingmonkey456
    "Despite beeing the oposite, they look very similar to me." - SparK

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