ActionScript 3.0 :: Collision Between Elliptical And Irregularly Shaped Object
Apr 22, 2009
What is the most efficient way to text for a collision between an elliptical object, and an irregularly shaped object (closely related to a line) that rotates?
View 6 Replies
Similar Posts:
Mar 8, 2011
Is there anyway to randomly place a MovieClip/Sprite on an irregularly shaped object?For a rectangle, it seems pretty straightforward (i.e. use Math.random with the range being the coordinates of an object)...but what if say, you would like to avoid placing objects in the center?
View 2 Replies
Jun 25, 2007
I have several movie clips of the main character (one for each primary and secondary direction), each of which contains 7 or so layers, one for each body part, and each layer then has about 6 keyframes, each keyframe containing a different graphic of the body part.All I want to do is create a shadow of the character. Originally, I just duplicated the main character movie clip, changed the _yscale, _rotation, _alpha and applied a color via setRGB(). It sort of worked, but because I was applying the setRGB() to the collective group of graphics having multiple colors, the variances showed up in the shadow, so you could make out the character's features.
View 2 Replies
Apr 15, 2012
I'm trying to improve a simple AS3 slingshot that is available at [URL] so that i can make it more realistic. I already changed it so that is possible to aim the ball in any direction, but now I'm trying to create a function that constraints the maximum pull of the slingshot to an elliptical area, preferably having the same two points of the slingshot as the ellipse two focus:
[Code]...
View 1 Replies
Oct 7, 2011
I am currently making a game based on slicing other objects, basiclly when you hold down and drag your mouse and then release it an object that shows the cut will be created.
//Sliceline.as
package
{
import flash.display.Bitmap;
[code]....
View 1 Replies
Mar 30, 2010
I am currently creating a game in which the character is stationary in the middle and the world moves in relation to the character. When the character is not moving and not touching anything, I need the world to shift upward to meet the character and stop on collision detection. The problem is I have no idea how to conceptually make this work.
making assets "fall up" and stop when colliding with an object (basically reverse gravity).
View 2 Replies
Jan 2, 2010
I have three objects in the main scene (so far), one of them is draggable (up and down only), then the animated one that moves downwards and the start button (activates the animation). So I've been trying to figure out how to script the collision detection for the first two? The collision should take place not because I dragged the slider onto the animated block, but because the falling piece hits the slider after I pressed the start button.
View 4 Replies
Feb 7, 2009
I need to detect collision between my bezier curve (drawn using curveTo method) and a object, the curve is dyanamic and hence the equation changes every frame. I am looking for a efficient method to detect collision between curve and the object.
View 1 Replies
May 10, 2010
I have two MC's on the stage. One of them is standing still in one position, the second one is moving towards it. I want the moving mc stop right at the very centre of the first mc. I've tried using hitTestPoint, but I don't know how to set the proper parameters. If I put there just: mc1.hitTestPoint(mc2.width / 2, mc2.height / 2, true), the trace function I use doesn't seem to have even noticed the collision...
View 1 Replies
Jan 17, 2012
Is there a way to test collision with a child of an object?eg.
ActionScript Code:
obj1.hitTestObject(obj2.childObj1)
obj1 and obj2 are on the same level of hierarchy.
I am trying to test when an object collides with a particular location of another object so i made a 1x1 movieclip (childObj1) and placed it inside obj2 at that particular position.
View 3 Replies
Feb 19, 2008
I read the tutorial about Multiple Object Collision Detection. What I want to do is have there be 3 circles and 3 squares. the circles are moving randomly while the squares are stationary. The actionscript would need to be checking to see whenever the moving circles collide with the stationary squares. However, it doesn't seem to be working. I followed the logic of the tutorial pretty closely, by making a separate list for the instance names. Here is the code for the collision detection.
[Code]...
View 1 Replies
Nov 11, 2011
I want to create a function in which I can drag a MovieClip which will bump into other MovieClips on the stage without overlapping them. (i.e. the object cannot be dragged over or through other MovieClips).
function dragHolder01(event:Event):void{
if (mouseDownHolder01 == true) {
for(var m:int = 0;m<blockHolder.numChildren; m++){
[code].....
View 3 Replies
Mar 28, 2012
I'm trying to have an enemy's shell hit my player. I have the logic in place that detects a player's bomb hit an enemy, I tried to edit it slightly and apply the same logic to the enemies shell.
Code:
// check for collisionspublic function checkHits(event:Event)
{
[code]......
View 2 Replies
Jun 1, 2009
I need to make a dragable button but I need this object to stay clear from other objects on the stage so to act like pushing away other objects on the stage.
View 7 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
Jun 23, 2009
I am creating a game where I have two separate arrays of objects that I need hitTested with each other. I found an old tutorial in AS2 that I modified to come up with this code:
ActionScript Code:
for (var w:Number = 0;w < enemyLaserArray.length;w++) {
for (var R:Number = 0;R < barricade1Array.length-1;R++) {
if (enemyLaserArray[w].hitTestObject(barricade1Array[R])) {
[code]....
This code executes like I believe it should, but along with removing the two objects, and splicing them from their arrays, I get this error
Code:
TypeError: Error #1010: A term is undefined and has no properties.on the line hitTestObject line. I have had similar problems in other areas of my project, but this time no matter what I try using trace statements I cannot fathom quite what the problem is.
View 2 Replies
Oct 13, 2005
Right now I'm working on an advanced hitTesting engine, and What I'm trying to do here is create an engine that will detect collision with one object instead of two. That basically means that if any other objects touch this movie clip, the hitTest will return True. Right now the .fla containing the engine has nothing but a circle that can be moved using arrow keys and 8 squares that disappear when touched by the circle. Obviously, I could do something like:
if (circle.hitTest(square1)) {
do so and so
} else if (circle.hitTest(square2)) {
do this and that
} etc...
But that would be too long, since the engine has to be able to contain 100 squares without too much change in the code.
View 3 Replies
Feb 28, 2009
so I have a function on the Main Timeline that creates an instance of the class Ball once every 60 frames (1 second). In the class code for Ball I have this:
Code:
package {
import flash.display.MovieClip;
import flash.events.*;
[Code].....
As you can see, I am trying to make it so that if two instances of the class Ball collide, then it should output "STOP". But it isn't working.
View 7 Replies
Feb 22, 2010
As the title says: Stop object from moving further when collision occurs.
Right now I'm trying to make a sliding puzzle. So far I have a block which I can click and drag around, and a few walls which are the boundaries. What I'm trying to do is make an area where the block can slide within the boundaries. So when you try to drag the block into an direction it will stop, whether you got mouse_down or mouse_up. My script so far
Code:
stop();
//Sliding Blocks
MCBlock1.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
[Code]....
Also I need to use a lot of boundaries, so if there's a way to apply this script easily to several objects
View 1 Replies
Apr 3, 2012
The scenario: in Main, instances of class Bullet are spawned and added to the stage, and to the array bltarray, instances of class Enemy are spawned, added to the stage, and added to nmearray. This works fine.
The problem comes in seemingly sporadically, i.e. it works, then suddenly doesn't work soon after, when it doesn't work I get spammed with output errors and the score display is constantly rising, note it's the same instance of bullet and enemy. [code]...
View 1 Replies
Sep 8, 2009
I created a .PNG in Photoshop (see attachment) -- now when I make this into a movieclip the bounding box covers the entire area so the hittest activates as soon as my helicopter flies into the bounding box.I looked at adobe's "help" they recommended this code (by the way, I'm using Flash 8):
my_mc.hitTest(x, y, shapeFlag )
my_mc.hitTest(target)
The way I interpreted the code was like this:
onClipEvent(enterFrame){
heli.hitTest(248.1, -38, shapeFlag)
}
I read somewhere that you only use one of the two, and the shapeFlag one is the one to use.The above code I placed into the helicopter MC (named heli) - I set the x & y to where the PNG is.The PNG moves towards the helicopter, so I'm not sure if that makes a difference.I just want that if the helicopter runs into the ceiling or floor, the level resets.However my current actions activate as soon as it hits the bounding box.This is my code in the PNG:
onClipEvent(enterFrame){
this._x -= _root.levelSpeed;
}[code]....
I've tried a lot of things, and nothing seems to be working.
View 5 Replies
Jun 22, 2010
I have almost everything working except for collision with the bricks. This is based heavily off the "Flash Games University" example although several things are changed. When the game starts with brick collection detection in play, and the ball appears the entire thing freezes. I get this error: Error #1009: Cannot access a property or method of a null object reference. It repeats 28 times - the number of bricks. The error seems to be occurring at "var brickRect:Rectangle", according to debug and observing. It may be a scope issue, but what should I change to fix?
[Code]....
View 5 Replies
Oct 16, 2009
In my file (AS2), I have a small square at the middle of the page. Diagonally to the right, I have a vertical wall which is a rectangle. Pasted inside my small square, I have the code:
onClipEvent(enterFrame) {
if (Key.isDown(Key.RIGHT)) {
if (this.hitTest(Wall._x, Wall._y, false)) _x =
[code]......
View 1 Replies
Oct 9, 2009
if I had a better understanding of bezier curves. This should draw a wedge of specified angle and radius, with the the bisector a vertical line. There appears to be something I don't get, because the curve does not conform to a perfect circle.
Code:
function doWedge(rad, angle, target) {
//angle to radians, then cut in half
[code].....
View 2 Replies
Apr 1, 2010
I'm dabbling with 3D tweens but I've hit a snag. The tween works fine on it's own and also with a simple mask on it. My issue is when I add a second keyframe to the mask layer to create a different shaped mask. When it reaches that frame my 3d tween goes crazy and flies off.
View 1 Replies
Dec 16, 2010
What I'm trying to do is hittest two irregularly shaped objects using their alphas and not the bounding box.
The code below hittests two objects named target 1 & target 2. This is not my code, but mine looks exactly alike, except target 1 & target 2 are replaced with my MC's. the thing is, I keep getting an error.At every function line, like the "public static function complexHitTestObject I get an error that says: Expecting right paren before left-bracket. I don't know what this error is caused by, because I can't really see why Flash wants another right paren.
[Code]...
View 6 Replies
Aug 2, 2010
I want to make a simple animation with some photos. But I'd like to create this in a circle shaped workspace (stage), so when I export the movie as a .swf it will be shown as a round document, instead of the basic rectangle.
View 1 Replies
Jan 30, 2012
I am looking for a way to get a similar effect as posted in the Adobe forums The current solution is very brute force using about 60 intermediate shapes gradually going from the outer shape towards the inner shape while slightly changing the color each time.
[Code]...
particular problem, I only wanted to have a shape fade into the color of the background so my solution was to draw the image slightly larger than usual and use Flash's blur filter to create the gradient effect. This is suitable only because my background image is a solid color so this won't work for everybody. This is also a very cpu intensive method but is faster than drawing 60 shapes.
View 1 Replies
Feb 3, 2012
I have a series of dots on a world map that depending on certain criteria move from one country to another. At the moment they move to a random point around the country's (mc) centre, as calculated by addind half the width to the x or y coordinate etc. This pressents certain problems such as the centre of the US is actually outside the boundries of the countries borders because of Alaska. Other countries such as the UK have dots floating just off the coast. The dots also cluster coveringing each other up.
Is it posible to generate a random x and y coordinate that is inside the boundries of an irregular shaped mc such as a country. I know that Flash must have these values because of colision detection and mouse overs. I just don't know how you go about accessing them.
View 3 Replies
Sep 30, 2009
I need some tips, algorithms, code samples, whatever relative to building random shaped close smooth curves, that have no intersections, not many "close to intersect" parts. Pretty much like on the image attached. If there are any algorithms for the same task but allowing intersections - would be great to know too.
View 4 Replies