ActionScript 3.0 :: When A Circle Hits A Square
Oct 15, 2009
i would like to know when a circle hits a square.Following code returns true when the rectangle of the MovieClip (blue) hits the square and not the circle itself:
circle.hitTestObject(square);
In as2 you had an extra parameter to indicate that.
View 3 Replies
Similar Posts:
Jul 27, 2003
I have a square that is a button symbol. There is a cirlce that is a movie clip symbol. I assigned the following actions to the button
on (keyPress "Left") {
currentX = this._x;
this._x = currentX - 2;[code].........
For some reason, the square and the circle both move. how can i just make the block move and not the circle.
note: the <> symbols are not put surroundin the key names
View 1 Replies
May 4, 2010
just wondering how i can add a small explosion like thing when the ball hits the yellow circle, and not just a picture appearing on the hit (game attached, and using adobe Cs5)
View 2 Replies
Jan 30, 2009
I want to build a specifik thing in flash, and don't really know where to start.... Say I have:
3 images of 3 three different squares
3 images of 3 three different triangles
3 images of 3 three different circles
The first thing you see is Square 1, Triangle 1 and Circle 1. If you were to click on Choose Square, Square 2 will appare in Square 1s place. If you click on it one more time, Square 3 will appare, and then round again to Square 1. Same thing for all the shapes.When you're satisfied with your selection of shapes you click OK and then you get to see a movie, based on whatever choices you've made. Because there are 3 different shapes and 3 different objects within each category, there will be 9 different movies to watch (3x3=9).One example of how this could turn out is:
Square 1 + Triangle 1 + Circle 1 = Movie 1
Another one could be
Square 2 + Triangle 2 + Circle 2 = Movie 6
View 10 Replies
May 28, 2010
I have a square object in the middle of circle.and i can move square object using up, down, left, riht arrow keys. I need script for when square object touches circle, then it goes to back, I have use for this below code :
var myobjdim:Array=new Array;[code].....
In above code "myobjdim" is square object and "bg1" is circle object..
View 1 Replies
Jul 10, 2009
I have a circle and a big square. The circle can be moved using the keyboard. I want the square to act as an obstacle, so the circle cannot be moved into it and the circle stops when it hits it, just like a if i were to try to walk into a building. Is there an easy way to do this?
View 7 Replies
Jul 27, 2005
how to draw a square/circle/anything one pixel at a time, using Actionscript instead of tweens?
View 1 Replies
Jun 18, 2008
I have a circle and a square on the stage. When you click on the square the circle will go to "circle._x = 300" when the circle is at 300 I want to make it when you click on the square the circle will go "circle._x = 45"
Code:
moveCircle = function () {
circle._x = 300;
if (circle._x >= 300) {
circle._x = 45;
}} square.onRelease = function() {
moveCircle();
trace(circle._x + "is the position of the circle");
}
View 5 Replies
Aug 15, 2003
-Take a circle and place it in the center of a square scene.
-Make a rectangle and snap its left edge to the circle's center.
-Make another rectangle and snap its left edge to the right edge of the first rectangle.
How would you make it so movement doesn't happen at the registration point but on the whole arm. Say i ran a rotation script on the upper arm with +=1 and the lower arm with +=2. How would you place the parts, what format would they be converted to and what would the script format be. Multiple methods would be welcome of course!
View 1 Replies
Dec 2, 2010
when creating a dynamic square with the api. 400 by 400. I am not sure why it wont draw the object
[Code]...
View 2 Replies
Jan 15, 2010
I have this game, and some levels have a moving square as the player, you move the square with your arrow keys.... I want to have an enemy square that chases the player square.... They only chased mario when you didn't look at them? Kinda like that...... but in this regards:
I only want the enemy square to chase the player square when the player square moves.... soo say the player square moves 5 pixels per movement (know how to do all that), I want the enemy square to move when the player square moves..... towards the player square at like 7 pixels per movement..... so eventually you won't be able to avoid the enemy square....
View 4 Replies
Mar 8, 2005
I'm developing a game atm, and I need some help on the mathematics/coding of colliding circles (and their change in x/y speed). What i need to know is how to calculate the direction and speed a circle has after colliding with a static (non-moving) circle. I know how to detect a collision between the two, but I'm not sure about the maths I need to give the circle the right speed and direction after the collision
If i do know how far away the two circle-points (in the middle of each) are to each other (in both x and y coords) would it be easy for me to find the new speed and direction of the large circle in the example above? I know that I somehow should use the angles to pretend the circle hits a flat "wall" (as it only hits one point), and then calculate the new speed/direction. My only problem is that I'm not sure how to decide the angle of this flat "wall" and how x and y speeds should change when colliding with a wall that is angled. Does anyone here have any insight, links or tips on how I can du this?
View 6 Replies
Sep 30, 2005
i want to make one circle follow the mouse cursor, inside another circle. Similar to an eye looking at the cursor. Ive attached an example.
View 4 Replies
Nov 5, 2008
I have text in a dynamic field showing up as circle. I want to say if circle shows up change it to cercle (french).
[Code]...
View 1 Replies
Mar 8, 2005
What i need to know is how to calculate the direction and speed a circle has after colliding with a static (non-moving) circle. I know how to detect a collision between the two, but I'm not sure about the maths I need to give the circle the right speed and direction after the collision.If i do know how far away the two circle-points (in the middle of each) are to each other (in both x and y coords) would it be easy for me to find the new speed and direction of the large circle in the example above? I know that I somehow should use the angles to pretend the circle hits a flat "wall" (as it only hits one point), and then calculate the new speed/direction. My only problem is that I'm not sure how to decide the angle of this flat "wall" and how x and y speeds should change when colliding with a wall that is angled.
View 6 Replies
Aug 24, 2009
I`m working on a app that you can draw lines.....like circles, rectangles... my problem is when a user draw a circle for example....i wanna be able to paint (change color) inside of this circle. I`ve tried working on Shapes with cacheAsBitmap = true and Bitmaps with BitmapData but it doesn`t seens to work.
View 4 Replies
Mar 16, 2012
I want to create circle, and put 8 points on it. So, user can drag each point in order to change it's shape.
Is there any way to do this in flash?
I have some following code:
Ref. - How to draw a continuous curved line from 3 given points at a time
package{import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.geom.Point;
[Code].....
So, can anyone convert these three point curve line to 8 points circle?
View 1 Replies
Oct 6, 2009
I have to draw a circle using action script. The Circle Diameter has to be controlled by a button.
View 0 Replies
Apr 10, 2010
Trying to do circle circle collisions via math which I'm really having trouble with. One circle (player) just moves from keyboard. The ball reacts to the player. All the code shown is in my players class and I passed in a reference to the ball.
On my enterframe I have:
Code:
var xmov1 = xSpeed;
var ymov1 = ySpeed;
var xmov2 = ballRef.xSpeed;
var ymov2 = ballRef.ySpeed;
[code]....
Perhaps I'll go with a box2d equivalent instead of trying out my own physics shenanigans.
View 2 Replies
Sep 19, 2004
Here I what i need is : Start drawing first circle and when first circle is on half way, Start second circle.same way second and third circles. and after completing 3 circles, just gotoAndPlay 2nd Frame .
View 3 Replies
Feb 18, 2010
I have a simple three ring animation where the three rings fade in and out.On the stage the rings are a perfect circle, in the publish preview they look fine, but once I publish the SWF, all of the sudden the rings are not perfectly round anymore.
They are almost perfect but right at the top and bottom there is just a small portion which has sort of "flattened out"...
View 2 Replies
Apr 26, 2011
I bought a Flash video tutorial online for Animating and the FIRST step is to create a circle with the circle tool, and the guy does it online, and it fills itself in. I repeat his actions exactly and I cannot get the same result at all. I just get a circle.
View 5 Replies
Apr 5, 2007
I have two MC's, circular in shape. One of the circles is stationary and you can drag the other. I'm trying to get the moveable circle to be able to move around the circumference of the stationary circle, but not overlap. I'm able to detect when they overlap, not using hittest. I just can't figure out how to code it so that the draggable circle can't be moved over the stationary circle.
View 4 Replies
Jul 5, 2010
Does anyone know of any tutorial or code example that deals with resolving circle-circle collisions including rotation?
View 2 Replies
Jan 6, 2012
I have been trying to get this right for hours now it cant be as hard as I am finding it! but basically I have a circle and in that circle is a circle and all I want is for the inner circle to not be able to leave its parent. that's it but I just cant get it to work.
View 1 Replies
Jul 3, 2009
I'd like to make a circle slide ( Slider that on the shape of circle instead of vertical and horizontal Slider) like this one:
[URL]
Is there a ready Component on the web.
View 0 Replies
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
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
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
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