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

Thread: Help me

  1. #1

    Help me

    alright say that you have a game were a block goes back and

    fourth and if the block hits a wall it will stop and just not move in

    that direction. how would i do this.... thanks in advance

  2. #2
    its actually really easy

    assuming the movement of the block is actionscripted and the wall is a mc with instance name wall, just use the hitTest function on the onClipEvent handler like this

    if(this.hitTest(_parent.wall)){
    //code for stopping the mc here
    //for example speed=0
    }

  3. #3
    Please use better titles than "Help me"
    Wait, what?

  4. #4
    Originally posted by Voetsjoeba
    Please use better titles than "Help me"
    Like:
    For the Love of God!
    or
    OMFG! :@
    or
    DARN AS'ing!
    or
    I've had it with this game!
    ...

  5. #5
    alright so how would i be able to make the move clip stop when it

    hits the wall...something like this...

    if(this.hitTest(_parent.wall)){
    this._x+=0
    }

  6. #6
    if that is not right please help

  7. #7
    its not right

    you have to have a variable that controls the speed

    say u previously had

    onClipEvent(load){
    speed=4
    }
    onClipEvent(enterframe){
    _x+=speed
    }

    you add to the enterframe

    if(this.hitTest(_parent.wall)){
    speed = 0
    }

  8. #8
    alright i got it to work thank you all for helping

  9. #9
    u r welcome.

  10. #10
    Hay everyone! I'm kinda new and need help I was trying to do basicly the same thing but Flash came up whith the error:
    **Error** Scene=Game, layer=1, frame=1:Line 37: Statement must appear within on/onClipEvent handler
    if(this.hitTest(wall)){
    And I need some help on what to do.
    Thanks

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