PDA

View Full Version : Help me



bombsledder
February 27th, 2004, 10:47 PM
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

flash4food
February 28th, 2004, 02:25 AM
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
}

Voetsjoeba
February 28th, 2004, 04:31 AM
Please use better titles than "Help me" :sigh:

El_Thierro
February 28th, 2004, 08:11 AM
Originally posted by Voetsjoeba
Please use better titles than "Help me" :sigh:

Like:

For the Love of God!
or

OMFG! :@
or

DARN AS'ing!
or

I've had it with this game!
...
:sigh:

bombsledder
February 28th, 2004, 10:38 AM
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
}

bombsledder
February 28th, 2004, 10:38 AM
if that is not right please help

flash4food
February 28th, 2004, 05:24 PM
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
}

bombsledder
February 29th, 2004, 05:33 PM
alright i got it to work thank you all for helping

flash4food
March 1st, 2004, 08:53 PM
u r welcome.

Bannana
June 15th, 2007, 09:22 PM
Hay everyone!:te: 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:thumb: