The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


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