PDA

View Full Version : NEED HELP ON OTHER ACTIONSCRIPT!



smurf123
02-29-2004, 12:29 PM
Hi, I would really like some help. What I am trying to do is when an object hits another, it goes to frame 2. I have the object moving(labeled "Mover")and my problem is that I dont know how to make it do that action when it hits the spot. For the "spot" it hits should I use an MC or just coordinates. If I use an Mc could you also tell me what actionscript I would put in either MC. If its coordinates, Would you please tell me what kind of "If" command I would use for that?
Also in case your wondering, heres my code to move the guy around.



onClipEvent (load) {
speed = 2;
}
onClipEvent (enterFrame) {
if (key.isdown(key.RIGHT)) {
_x+= speed;
}
if (key.isdown(key.LEFT)) {
_x-= speed;
}
if (key.isdown(key.UP)) {
_y-= speed;
}
if (key.isdown(key.DOWN)) {
_y+= speed;
}
}

It would be real helpful if you could help me!

blake
02-29-2004, 08:12 PM
Hey try this code!



onClipEvent (load) {
speed = 2;
}
onClipEvent (enterFrame) {
if (key.isdown(key.RIGHT)) {
_x+= speed;
}
if (key.isdown(key.LEFT)) {
_x-= speed;
}
if (key.isdown(key.UP)) {
_y-= speed;
}
if (key.isdown(key.DOWN)) {
_y+= speed;
}
if (_root.mover.variableofother, hittest(_root.variableofother)) {
_y += 6
updateAfterEvent();
}}

ok what this does is when it collides with the movieclip withe the variable of 'variableofther' its will keep going down 6 frames at a time till it is free. Change it to suit you.

Cheers, Blake

pra_kashkumar
03-06-2008, 10:23 AM
Dear friends,

I have tried both of these but sorry to say that none or these are working so u may try this.

onClipEvent (load) {
speed = 2;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_x+= speed;
}
if (Key.isDown(Key.LEFT)) {
_x-= speed;
}
if (Key.isDown(Key.UP)) {
_y-= speed;
}
if (Key.isDown(Key.DOWN)) {
_y+= speed;
}
}


Love Prakash

tutorialjcw
03-10-2008, 03:00 AM
try this code