ActionScript 2.0 :: Bounding A Randomly Moving MC?
Apr 26, 2010
I am creating a banner with a "moving target", but the target keeps moving under the copy text of the banner, making it illegible.here is my random movement code (Swiped from kirupa if I recall ) :
//special thanks to Suprabeener for the code
function getdistance(x, y, x1, y1) {
var run, rise;
[code].....
View 0 Replies
Similar Posts:
Sep 15, 2011
Issue: I need to move a rectangle (that has only sides and no fills) to a specific location on the animation, what happens is that if the user enters some info (through HTML form processed by PHP and sent to the movie through FlashVars), this info should then me find the x and y coordinates of a button that should then be overlapped by this said rectangle.Code:
Code:
if (_root.signUp == 1){ // the FlashVar variable flag
var buttoSym= "_root.thumbMain.thumbSymbol.b" + _root.signNumber
[code]......
View 8 Replies
Nov 1, 2010
Is it possible to make a bounding circle instead of a bounding box?The objects should bounce INSIDE the circle.I have now a bounding box outside the circle, but the objects exceeds the circle at the corners.
I was thinking of making an array of Points on the edge of a circle and when the object is < or > then do something... but that would be a lots of if/else statements.
View 3 Replies
Mar 13, 2003
I want to have a few movie clips moving randomly over my flashsite. They will look bugs. And I want them to move in the direction the head is pointing.I have tried the random movement tutorial here on Kirupa but can't get the mc to rotate in the direction it's moving.
View 14 Replies
Aug 19, 2003
I use Flash 5
I went to this (click HERE) site. After a moment, it takes you to the main site.
The top banner is moving randomly over 3 or 4 pictures.
View 6 Replies
Apr 26, 2010
I am creating a banner with a "moving target", but the target keeps moving under the copy text of the banner, making it illegible.
here is my random movement code (Swiped from kirupa if I recall ) :
//special thanks to Suprabeener for the code
function getdistance(x, y, x1, y1) {
var run, rise;
run = x1-x;
[code]....
I have tried modifying the " width = 300; height = 180;" line, but it does not seem to be changing much, if anything. I am trying to bound the random movement to the bottom 180 pixels of the composition.
View 2 Replies
Nov 10, 2003
lets jsut say like were randomly moving a moveclip around how do i click on it and stop it?
View 3 Replies
May 3, 2011
I wasn't quite sure how to describe my problem in the subject. I have a plane MC and a crate MC. The plane only flies along the y axis from the bottom of the screen to top. Along the way I want it to randomly drop the crate MC. My code is below. The problem is that the crates spontaneously keep spawning and not near the plane.
function movePlane():void
{
var tempY:Number;
[code].....
View 1 Replies
Oct 27, 2011
I'm working on my first game engine with AS3 and I'm hitting my first real setback. The idea is that the player controls a centered "turret" on the screen and can't move. Enemies come from all 4 sides and move towards the player. I have all the enemies spawning, randomly, on the edges of the screen. However their movement is silly, because I've coded it like this:
Code:
if (x > 300)
{
[code]........
View 2 Replies
Aug 6, 2005
I want the final result to be a stage with a certain number of circle MC's moving around. I have made the circle MC, and added the AS so that it will start at a random point with a random color, then start moving around randomly. I want to make it so that In the beginning the document will duplicate the movie clip x amount of times, using a for loop. I want to then have all the new circles move around, and when two circles hit each other, they will dissappear, using the removeclip function. You can only use this on duplicated movieclips though, so how would i make all the circles duplicated? Is there a way to duplicate the original movieclip x amount of times then delete it? Or is there a way to remove the original after it is in a collision? Also I don't know how to do the collision detection. I am thinking of using a hittest, but would I just do it with a for loop? Is there a way so that if an MC hits any other MC?
View 3 Replies
Oct 26, 2011
Making a ship game because I am incredibly original.. With that aside, I have a problem. I have a function to fire bullets from my ship based on its rotation which works.. it uses this code on creation: ember ho jis ny mmujhe block kia hai
[Code]...
The above code is in my Ship class so I can easily make the bullets achieve the correct rotation. And to continually update its position, in the bullet's class:
x += Math.cos(rotation / 180 * Math.PI) * speed;
y += Math.sin(rotation / 180 * Math.PI) * speed;
So that all works well. But I have another class, EnemyBullet, which randomly generates and uses similar code to set its direction and movement. In my ship class:
[Code]...
I gather that the rotation is therefore always horizontal, but can't for the life of me see why? Can anyone give me an answer? Assuming it's simple enough because the code I used to setup the rotation is the same working code I have used to turn a movieclip towards the mouse..
View 1 Replies
May 30, 2005
I have gone through the tutorial on this site regarding random movement. But I need it to be kept in a frame. This is the code(from this site)
Code:
function getdistance(x, y, x1, y1) {
var run, rise;
run = x1-x;
rise = y1-y;
return (_root.hyp(run, rise));
} function hyp(a, b) {
[Code] .....
Lets say I make an physical border for the element. A "box" 200x100 and this box is centered. How do I keep my random moved element inside this "box" or frame you may call it.
View 1 Replies
Dec 15, 2004
I have a bunch of dots moving randomly on the screen. They are all copied and pasted versions of one MC with some script attached.Over the top of them is a giant invisible button. When I click the button (anywhere on thescreen) a VISIBLE button appears. When I click again (anywhere onthe screen) I want all the randomly moving dots to move towards the VISIBLE button.
View 2 Replies
May 12, 2005
how to randomly animate circles moving around inside a bigger circles? the small circles will have a collision effect on each other and on rollover of each individual circle, the name of it will come out in the bottom.. so the big circle will act as a wall preventing them from coming out..
View 1 Replies
Sep 24, 2007
Onmy stage I have a MC, and when I click it a random MC from the Library should appear and move around randomly.
I'm using this to make it move around randomly [URL]
how to make the random MCs appear from the library. And should I put the random moving script on each of my ten MC?
View 8 Replies
May 5, 2008
I have noticed when setting a bounding box on a drag object, if you go outside the bounds of the box you have set, the mouse won't let go of the object unless you go back inside the bounds and click on it again. Is there any way to force the stopDrag if you go outside the bounds while dragging? I have tried this bit of code:
[Code]..
View 3 Replies
Jun 9, 2010
I am currently in the middle of creating a project which essentially uses Flash as a type of augmented reality system. The idea behind it is that a webcam input will capture a users hand which is placed on a white pedestal (esstially creating a complete white backbround in contrast to the hand). Create a bounding box around the hand so that objects will only move in the space taken up by the hand.
The problem I am having is wondering which functions i should use to create a bounding box that will select the space that the hand is taking up in the webcam input. I have seen the function GetColorBoundsRect but it only seems to focus on one colour and it seems to be a static function instead of one that will need to constantly create the bounding box if it moves. This isn't just a motion dection but will need to detect the hand even if it isn't moving.
View 0 Replies
Jun 23, 2009
This PNG image is rather large, and only a small portion is filled with pixels. Most of the image is transparant.I want to apply the effect only to the part with pixels, so I'd like to create a boundingbox around that part of the image. I need to know 4 things to do this (the way I see it...): The position of the top-most non-transparant-pixelThe position of the left-most non-transparant-pixelThe postition of the bottom-most non transparant-pixelThe position of the right-most non-transparant-pixel
View 1 Replies
Jun 6, 2009
Is there any simple code that will make a hittest not work of the bounding box in flash, because I've been looking for something for a while now, and can't find anything about how to do that.
View 1 Replies
Jun 12, 2009
I am trying to create buttons on a 45 degree angle. They are simply text. I have tried drawing different hit areas for the button, but when I publish the swf the hit area for the button is always its bounding box (so there is a huge space in the upper left and lower right corner which activates the button).
View 1 Replies
Dec 17, 2009
I'm trying to do collision detection for my game, but I don't necessarily like the premade methods hitTestObject or hitTestPoint just as they are. I've been searching all over the place for how to change the bounding box of a symbol, but all I found was how to get its bounding box. I'm aware of the pixel perfect collision detection code out there, but I'm looking to use bounding boxes for certain classes.
Is it possible to change the symbol's bounding box and still have that box recognized by hitTestObject or hitTestPoint? If not, I might have to write my own colllision detection code. =/
View 2 Replies
Dec 21, 2009
I like to know is "where, exactly, are you drawing that glyph?" The TextField class provides the methods getBounds and getCharBoundaries, but these methods return rectangles that extend far beyond the actual bounds of the whole text object or the individual character, respectively.
var b:Sprite = new Sprite();
b.graphics.lineStyle(1,0xFF0000);
var r:Rectangle = text.getCharBoundaries(4);
[Code].....
Is there any way to get more precise information about the actual visual bounds of text glyphs in ActionScript?
View 3 Replies
Jan 25, 2011
I'd like to do fancy things the selection indicator. How do I get the bounding box for the currently selected characters?
View 2 Replies
May 31, 2011
I'm trying to animate a simple stick figure just now. I used an inverted triangle shape for the body,which gives a nice width to the shoulders. Unfortunately, flash doesn't seem to realise that it's a triangle. Due to it's stubborn way of drawing a rectangular bounding box around every shape.
This is getting in the way a lot, as there are parts of figure which are clearly not blocked by the torso, but are blocked by it's big square bounding box, which makes it a nightmare to drag the arms and legs around to where I want them
Is there any way to fix this silly behaviour, and have it only select an object when I click on a visible part of it, and not just anywhere in it's bounding box ?
View 5 Replies
Mar 7, 2009
Anyone know of a method whereby when i click on a movieclip on my stage i can create a bounding box which will allow me to click on any corner and re size the box manually......?
View 1 Replies
Jun 24, 2009
I'd like to do fancy things the selection indicator. How do I get the bounding box for the currently selected characters?
View 1 Replies
May 25, 2010
I'm making a simple platformer. I have an array holding what my level looks like and my main character is a horse.... okay it's a unicorn... anyways, Whenever I jump to a platform the hittest is saying that he has landed even though his head or his tail is just over the edge... I'm trying to make it so that only his feet will allow him to land.
View 1 Replies
Dec 10, 2010
Quick question which is giving me difficulty, but I'm probably missing something...
How would I create a bounding box for any graphic, which can accommodate the graphic while bring rotated?
Simply making a square with the maximum of width or height doesn't cut it... think for example holding a T..
View 4 Replies
Nov 6, 2011
I need to draw bounding box surrounding a movieClip with arbitrary registration point with AS3. The movieClip may be of any shape and can have it's registration point anywhere.
View 5 Replies
Dec 1, 2004
I'm not sure if bounding box is the right term or not.I have loaded an external swf (photoSlider.swf) into my main swf (resume.swf).The issue is that the photoSlider.swf is 420x290.The photoSlider.swf loads in external JPG's from an XML file, and slides them across the stage, but the JPGs extend out past the width of the photoSlider.swf stage. So when I load it into resume.swf, it isn't bounded to the 420x290, it extends out past that.Is there a way to set a bounding box for the swf?
View 2 Replies