ActionScript 3.0 :: Stop An Object When It Hits Another?

Nov 12, 2009

Im making a sort of maze game and have a ball that moves up, down, left and right when the corresponding arrow key is pressed. What I want to do now is introduce some walls, how do I make the ball stop moving when it touches a wall? (so it doesnt pass through the wall)

View 1 Replies


Similar Posts:


ActionScript 2.0 :: Make Something Stop When It Hits Another Thing?

Jan 7, 2004

I am wanting to make a game, and I need a gravity code that works great. I want gravity, a jumpibg code, and then a code to make something stop when it hits another thing.

View 2 Replies

ActionScript 2.0 :: If Object 1 Hits Object 2 With A Speed Greater Than 10?

Dec 19, 2010

I wonder if there is a way in actionscript 2 that makes something happen if an object hit another object with a specific speed. For exemple: If Object 1 hits Object 2 with a speed greater than 10 I want something to happen.

View 5 Replies

ActionScript 2.0 :: Collision - Character Shall Stop Movement If He Hits A Geometry

Aug 7, 2008

am pretty new to Kirupa and Flash. I have a little problem, concerning a character hitting a wall. What i have: a char that can jump and move around by the arrow keys. What i need: character shall stop movement if he hits a geometry. But being able to start movement again, besides through the geometry. I'd like to reach this with gskinners CheckForCollision class. Have a look here: [URl] But i didnt manage my code to get it work. So maybe you could leak me some information on how to get this done. Heres my code so far:

[Code]...

edit admits: so far i have a character mc called "player" and one called "level". i would apply the code to the player, and it would be cool to have the possibility to check collision of the player with multiple MCs, not only the level.

View 2 Replies

Object - Two Movieclips In CS5 Hits?

Dec 5, 2010

I have two movieclips A and B when the movieclip A hits the movieclip B , I want the movieclip A to be removed what code should i write for this flash problem ?

View 1 Replies

Flash - Get The Blue Object To Disappear Once It Hits A Red One?

Jul 23, 2011

I have a grid of objects that have been added to the stage dynamically, the objects are either of a Class Red or Class Blue, how do I perform a hit test on the Classes? I want the Blue object to disappear once it hits a Red one.

View 3 Replies

ActionScript 2.0 :: Playing Sound When One Object Hits Another?

Jul 30, 2008

I am creating a kids game in AS 1 and want a "good" sound to play when a "good" object falls into the beavers basket and a "bad" sound to play when it falls into the basket. What is the best way to handle this in AS 1?

View 3 Replies

ActionScript 3.0 :: Game Loop - Detecting When Object Hits MovieClip

Jul 17, 2010

I'm trying to program this code:
public function enemiesDie(){
enemyLoop: for (var k:int = enemies.length -1;k>= 0; k--){
bulletLoop: for (var i:int = bullets.length -1; i>=0; i--){
if (enemies[k].hitTestObject(bullets[i])){
trace("hit");
[Code] ....

To detect when a bullet hits an enemy in a game I'm trying to make and I get this error:
TypeError: Error #1006: hitTestObject is not a function.
at Space_Hooligans/enemiesDie()
at Space_Hooligans/gameLoop()

View 2 Replies

ActionScript 3.0 :: Flash - Play A Movieclip When Dragable Object Hits Its Target

Aug 15, 2011

I've got tree movieclips called: greenpip(this is the dragable object, which is visable), greenpip_target(which is invisible, but becames visible when greenpip hits it, and grrenpip is becaming invisible) and then the third one: greenpip_flask (which is the animation I want to play when the greenpip hits the greenpip_target).
Everything works but I don't know how to make the greenpip_flask play, when grrenpip hits the greenpip_target. This scenario takes place three times with three sets of objects

View 5 Replies

ActionScript 3.0 :: Remove A Sprite Object When Another Sprite Object Hits It?

Mar 23, 2011

I have a brick class where I have created a rectangle using flash.display.graphics.I am using this brick class to create a grid of 10 X 10 in another class called grid using new brick() in a for loop.I have another class called ball where I have created a circle with flash.display.graphics.The problem is that I want to remove / destroy individual bricks when the ball hits the bricks on Event.ENTER_FRAME which is not happening.the error I get is shown only for the last brick that is created in a for loop.ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.

at flash.display:isplayObjectContainer/removeChild()
at grid/ball_movement()// my function in enter frame event
The code I wrote in ENTER_FRAME is

[code].....

View 3 Replies

ActionScript 3.0 :: Remove A Sprite Object When Another Sprite Object Hits It

Mar 24, 2011

I have a brick class where I have created a rectangle using flash.display.graphics.I am using this brick class to create a grid of 10 X 10 in another class called grid using new brick() in a for loop.I have another class called ball where I have created a circle with flash.display.graphics.The problem is that I want to remove / destroy individual bricks when the ball hits the bricks on Event.ENTER_FRAME which is not happening.the error I get is shown only for the last brick that is created in a for loop.[code]

View 1 Replies

ActionScript 2.0 :: A Line From One Point Past Another Point And Whether It Hits An Object?

Aug 19, 2009

I am using AS2 with Flash 8 Professional So, my problem is that I currently have a man in the middle of the screen, who shoots a line towards the mouse when I click. However, when I use hitTest to see if the line collides with another object, Flash recognizes the line as a large box if it is diagonal, so the hitTest isn't very accurate. The line only satys there for one frame, so I can't have the usual moving-bullet-style. I am either looking for a way to create an imaginary line with AS from the starting point to the mouse and beyond, and tell whether or not this line intersects with an object... or some other way that I haven't thought of to fix my problem. Keep in mind that the line rotates from a center point towards anywhere around it for 360 degrees.

View 1 Replies

ActionScript 3.0 :: Stop The Movement Of One Object When One Other Object Is Over One Third Object?

Jan 8, 2011

how i can stop the movement of one object when one other object is over one third object

View 1 Replies

ActionScript 2.0 :: Stop The Object From Dragging When The Object Was Already Dropped To Its Target ?

Dec 27, 2011

how can i stop the object from dragging when the object was already dropped to its target =)

here is my code :

var pointsCtr:Number=0;
s1_mc.onPress = function()
{
s1_mc.startDrag(false);

[Code].....

View 3 Replies

IDE :: When A MC Hits A MC

Jul 9, 2009

I'm making a small adventure game, and I want the game to go to the next frame once the main guy MC hits another invisible mc, like where the door is. I suppose another way of doing this is when the main guy mc hits an xy coordinate. So basically what I want is a script that says, when MainguyMC hit another MC/ coordinate, go to frame 2

View 14 Replies

ActionScript 3.0 :: Stop 1 Object Over / Under Lapping Another?

Jan 3, 2010

Is it possible to stop one object from moving into the space of another object?

I have 2 characters in a game, one is controlled by the user and the other just moves back and forth. at the moment the main character can pass right through the other character.

How can I make it so that the bounding box's never cross each other?

I have tried a hitTestObject, but this has to place the objects inside each other before the function is called. And if the main object is moving at high speed towards the 2nd object, then the 1st object will end up even further inside the 2nd object. Stop 1 object over / under lapping another?

View 1 Replies

ActionScript 3.0 :: Object Won't Stop Moving

May 11, 2010

I have this code where I want edge_btn to move to the left side of the stage, but I can't figure out how to get it to stop. It just keeps going. Also, I have edge_btn rotating the entire time in the beginning of the timeline.

[Code]...

View 0 Replies

ActionScript 2.0 :: How To Get Object To Spin Once Then Stop

Jul 29, 2005

I'm having a bit of a problem with this rotating object. It loops and never stops. I searched and found similar problems, but if I'm not mistaken most loops where done with tweens, unlike this one.
Code:
onClipEvent (enterFrame) {
i = getProperty(this,_rotation);
setProperty(this,_rotation,i + 7);
}
I basically want the planet to spin once, and then stop.

View 14 Replies

ActionScript 2.0 :: Detect Object Stop With X & Y?

Aug 12, 2005

I'm trying to detect when an object (a golf ball) in my game stops bouncing. I need to track it's x and y position and tell when they both equal a set figure (the hole) a hitTest wasn't working as it was detecting each ball bounce not when it stopped rolling. So when the x and y both equal a figure.

if ((this._x = -106.5) && (this 47.55)){
_root.cheer.play();
}

This doesn't seem to work.

View 5 Replies

ActionScript 2.0 :: How To Stop Moving Object

Dec 13, 2006

I am making a new site, and was making buttons that looked a little similar like this buts on the left) and wanted that to do with Actionscript.I followed a tutorial on Kirupa on moving stuff with actionscript

Code:
onClipEvent(enterFrame) {
speed = 30;

[code].....

View 5 Replies

ActionScript 3.0 :: How To Stop The Move Of One Object

Dec 26, 2010

i want to stop the move of one object when an other object passes over a specific point!!!!how i can do this threw a method?

View 8 Replies

ActionScript 2.0 :: Won't Stop Incrementing While Being Hit By An Object

Feb 3, 2012

I have a problem creating scores in my game. how can i stop it from incrementing +1? [cod]e...

View 2 Replies

ActionScript 3.0 :: Only Removes The First One That Hits?

Nov 1, 2009

I want it to remove everyone that it hits, but it only removes the first one that hits. I am sure the answer is simple, but i am slow. Here is the code:

ActionScript Code:
function removeSpawn(){
for(j=0;j<lvl1A;j++){

[code]......

View 1 Replies

ActionScript 2.0 :: Get The Box To Trace When It Hits Mc2?

Aug 5, 2005

_root>mc1>mc2>box

The box got this code:

PHP Code:

onClipEvent (enterFrame) {if (_parent.hitTest(this)) { trace("hitting"); }}

I want the box to trace when it hits mc2, but it don't works!

View 3 Replies

ActionScript 2.0 :: 2 Mc's Hits Each Other They Dissappear

Jul 13, 2007

I have 2 movie clips with a linkage. In a process both mc's are being attached lots of times and a new name is given to each every time.I want to make it so that is these 2 mc's hits each other they dissappear, but i can't do that because they all have different names and i don't know how to call to them.

View 1 Replies

ActionScript 3.0 :: Know When FLV Hits Certain Point?

Mar 23, 2009

Is there a way to keep track when an FLV hits a certain point in its playback WITHOUT using cue points? If so, how is this implemented and does it make the experience sluggish?

View 3 Replies

ActionScript 2.0 :: Get Object To Follow Cursor And Stop?

Jan 7, 2010

I am trying to get an object to follow the mouse cursor only when the cursor is within a certain range of the object.

I would also like the object to stop when the cursor is directly over it, so that it becomes a selectable button.

Lastly, I would like to apply this to many objects, that don't overlap, but rather, "bounce off" of one another. An example of this is at

[URL]

The code I have so far is:

ball_mc.onEnterFrame = function() {
var xMouse = _root._xmouse;
var yMouse = _root._ymouse;

[Code]....

"ball_mc" of course, is the instance name of the object that I have created.

View 4 Replies

Professional :: Stop On A Frame Then Click On An Object?

Feb 9, 2010

All I want to do is stop on a frame then click on an object and progress to another frame. MX was simple to perform this, with cs4 it seems to be a mine field any sugestions.

View 2 Replies

ActionScript 3.0 :: Rotate And Stop Rotating An Object

Oct 4, 2010

I want to rotate an object using the arrows on the keyboard when the mouse is over the object and it should not be possible to rotate the object when the mouse is not on the object. I know how to rotate the object, when the mouse is over the object, but when I put the mouse outside the object I can still rotate the object. How do I make the rotation stop?

[Code]...

View 4 Replies

Actionscript 3 :: Stop A Returned Object Being Modified?

Oct 29, 2010

If an AS3 method returns a reference to a complex type, is there any way to make that 'readonly', like how you can have const member functions in C++? An architecture I want to use calls for a class building itself from a passed template object... and really the template object should not be modifiable. I'm currently forced to add call-back enumerators and/or lots of extra accessor methods.

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved