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
Similar Posts:
Jan 8, 2011
how i can stop the movement of one object when one other object is over one third object
View 1 Replies
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
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
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
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
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
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
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
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
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
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
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
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
Apr 7, 2011
I have a ball moving around the screen, position updated on ENTER_FRAME. My problem is that there is a considerable amount of flicker going on. I have thought about using something like TweenLite to move the ball but as the position is being updated frame-to-frame I don't think that will work.[code]...
View 2 Replies
Apr 24, 2009
I want to smooth rotate thing_mc a certain amount when home_btn is pressed. Not sure how to do this. Obviously the below doesn't work.
Code: Select allhome_btn.onRelease = function(){
onEnterFrame = function (){
thing_mc._rotation += 5;
[code].....
View 4 Replies
May 21, 2005
this should be pretty simple for most, but I would like an explanation more than just a quick code fix. I put all the script together for this object, here is the fla. What I want to do is move it up to the y position as it does, but I need the object to move faster and stop there. Since I have given most of script in the main movie, I don't know how to write the script for the button release. All I can get it to do is crawl up with targety=100; but I still have the problem with the mouse follow once my button is pressed.
View 8 Replies
Nov 14, 2005
I am creating a flash project which contains video on a few pages. The project also contains background music which loops continuously. The goal is to have the background music stop whenever the user is on a page containing video and for the music to play again when the user leaves said page. The script I created works to stop the music, but it also stops the audio contained within the video and causes the video player (by proxxus) to lock up.
Here's the setup:
Library:
music.wav - linkage = "myMusic01"
Main Timeline:
Code:
//-- create a variable to determine if the current movie contains video
var currMovie:String = "notVideo";
//-- start playing sound object
myMusicMc.myMusic.start(0, 999);
[Code] .....
On the actions layer of the movie clip containing my navigation controls snippet of the callback used
Code:
videoLink_mc.onRelease = function() {
_parent.prodDetail_mc.gotoAndPlay("video");
_root.currMovie="Video";
}
on all the other buttons currMovie is set to "notVideo".
View 12 Replies
Feb 8, 2010
I am trying the get the center movie to stop remaining centered with the scaling movie when It gets less than 200 pixels of the left hand margin. x.200 and stop being centered on the y axis also at 100 pixels y.100 Here is the current code I was trying to write that is positioned on the object: Just avoid the comments, just left them there for reference to what's in my movie. Also need an if statement made for the y axis. (explained earlier)
onClipEvent(load){
this._x = Stage.width + 250;
this._y = Stage.height/2;
// This function will Position the object in Place
[code]....
View 1 Replies
Jun 27, 2010
Currently I'm trying to make a basic game (using AS 2) but I'm having trouble getting the basic physics to behave. I have a ball which is supposed to fall until it touches the ground. It can also be dragged around the screen by the cursor.I want the ball to fall only if it isn't being held, but for some reason the condition isn't working properly. No matter how I structure the condition, the ball still falls even when it's being held (in fact I can move it from side to side, it is still being held even though it's falling downward).I've tried putting this on the ball to make it fall conditionally:
Code:
onClipEvent(enterFrame){
if(hitTest(_root.ground1) == false){
[code].......
View 2 Replies
Jun 27, 2004
I use the letsMove function to move movieclips
MovieClip.prototype.letsMove = function(time, step, limit) {
countHundred = function (clip) {
clip._x += step;
updateAfterEvent();
[code]....
How can I use another setInterval function so, when the movieclip reaches the limit (in this case 100 pixels), it stops, waits for 1 second and starts the letsMove function again?
View 2 Replies
Oct 11, 2004
i need a movement script that makes an object move to where i want it to then stop. i cant seem to find a script for this anywhere.
View 4 Replies
Feb 20, 2012
I am trying to make star spinning (mouse cursor rollover the star, it would be change direction. and if click the star, it would spin start spin slowly and getting faster and then it would be easing stop.)[code]
View 3 Replies
Oct 11, 2009
Assuming, for a rectangle that is controlled by the user using the arrow keys, that I do the following[code]...
Assuming that works in detecting the collision, what would I use to actually stop the rectangle from progressing through the wall?
View 1 Replies
Feb 22, 2011
[URL]. Link to my problem .swf file. I am trying to get the bullet to fly in smoothly and ease to a stop. Also there appears to be some audio trying to play, but I have no audio in the library, or the stage! I can't get this animation to play smoothly at all. This was originally exported from an After Effects project (CS4) and there are only 8 layers - 1 for the bullet, 4 for button text, 1 of the main title, 1 of the dude standing (I'm hopefully going to have the title fly in from behind him) 1 of the bg and other text together. Why this animation won't play right? (I'm using Flash CS4 to do this).
View 2 Replies
Mar 25, 2011
I'm a young girl who recently discovered flash cs3 (I started yesterday) I found this tutorial about how to make a flying bird. I did as the tutorial said, I just made a butterfly instead of a bird. Now I made a flower and I want the butterfly to land on the flower. The tutorial only showed me how to make the bird/butterfly fly through the scene and not how to stop it while I still see it in the scene. I figured out how to stop the motion tween but then the butterfly dissappeared from the flash file after it stopped and I also figured out how to make it land on the flower but it keeps moving its wings Now I need help to make it stop moving the wings while it's still visible. I hope my explanation is understandable. As I said I just started with this program so I don't know how to explain all the different things.
I tried to upload the file on imageshack but it seems like it doesn't support this kind of file, or I'm saving it wrong. I could need some help with that too so I can show others what I'm making without that they have to download the file so it's easier to get help when I'm stuck A link to the .swf file [URL]
[Code]...
View 3 Replies
Jun 8, 2005
how do i stop the movement of an object moving from left to right. I want to be able to place it anywhere id like.
View 2 Replies
Apr 8, 2003
well i'm trying to get this object to move on the press of a key (keeps moving if you hold it down) and stop when you release it, but all i'm gettin, is when you press it, it moves on forever and never stops....
View 12 Replies
Jan 4, 2006
i have my fla here.
i want to stop the object from rotating when i roll the mouse over.
View 4 Replies
Oct 9, 2006
I have an interval problem.
Code:
//function for fading in objects
function fadeIn(theMc:MovieClip, fadeParam:Number) {
if (theMc._alpha < 100) {
theMc._alpha += fadeParam;
trace(theMc._alpha);
[Code] .....
I made a small function for fading in objects. Once the object its alpha is larger then 100, it should stop that interval, but it doesn't.
View 2 Replies