Flash :: Check Collision In A Drawn Curve / Instead Of Sprite's Bound Box?
Aug 23, 2010
There are two Sprite's hit tests, one check the object (and have no precision on the curves) and the other check a specified (x, y) point. But, having curves drawn using Graphics.curveTo(), how do I check if 2 drawn curves are colliding?I'm not sure if this is an actionscript or a math problem..I want to check all (x,y) of a curve to all (x,y) of the other curve..
View 1 Replies
Similar Posts:
Jan 19, 2012
I'm making a program that lets the user draw shapes on the screen with the mouse. When they're done they press a button to finish. The user is only allowed to draw on a certain area of the stage, to control this on the timeline i have a movie clip that takes up all the space the user isnt alowed to draw in.When the user presses the button i want the programe to check that the shape the user drew isnt touching the moiveclip. I want it to do this without taking the border of the movieclip into account so i cant use hitTestObject()
heres what i have so far:
//------------------------------DRAW SHAPE------------------------------
private var shape:MovieClip = new MovieClip();
[code]....
View 2 Replies
Nov 19, 2009
I am currently looking to see what the bounding are for the start drag method. And by the looks of it the bounding is set by passing the rect() object to the dragUpdater/ constructor. My question then is can you pass a custom drawn shape like a curve or what ever? By the looks of it you can not as specified by the adobe reference doc.
startDrag()method
public function startDrag(lockCenter:Boolean = false, bounds:Rectangle = null):void
So from this I would conclude that to have a custom drag path one would have to create a custom class.
View 2 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
Aug 26, 2011
I was hoping someone could help me working out some advanced data reformatting. What I'm hoping for is a function where I can input a value along with an array of key positions like so:
function remap(percentage:Number, keypoints:Array) { ...
The array would start with the minimum and end with the maximum point, with nested key points along the way. For example, I would input something like remap(0.25, [0:0,80:50,100:100] ) and the function would 'imagine' a spline curve graph from (0,0)-(100,100) with a key point of (80,50), then return the y value that is 25% along that graph.
View 1 Replies
Sep 18, 2009
I want to the user to be able to draw a line and then have a sprite follow the line as its path. Also, it would be nice if the line could be cleaned up after the user draws it with his/her mouse so that it is made up of clean curves/spline.
View 1 Replies
Aug 15, 2010
Let's say i have a simple app where on mouse move user draws a shape. What i am trying to accomplish is to detect if drawn shape is circle so was wondering what would be the best or easier way to do that?
I believe i should do some math based on every drawn point X,Y coordinates but i need a push in right direction from more experienced people around.
View 3 Replies
Dec 18, 2009
i have one ball and one rectangle in my fla file. i have finish to move ball using arrow on keyboard. but i want to check the collision when the ball hit the wall. i just can check the collision on the right side of the wall, the collision isn't work on the left, bottom and the top side of the wall
View 8 Replies
Sep 9, 2009
I want to curve a dynamic text from a straight line to circular curve (using a slider). I have placed the characters of the string in each textfield created at runtime.
View 3 Replies
May 23, 2011
i am working on a project that needs some collision detection. i have 7 objects and it should check collide for each others. i looked collision detection kit by Corey O'Neil, but cant figure it out.
View 2 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
May 10, 2007
I have a curveTo an anchor point and a control point.Then I have a function that will return the x and y of a point along that curve if I give it a number as a percentage of the curve (0 to 1).It looks like this, and works perfectly..
Code:
function drawOnCurve( interval:Number, x0,y0,x1,y1,x2,y2)
{
interval = Math.max( Math.min( 1, interval ), 0 );[code]....
x0,y0 are the start point, x1,y1 the control point and x2,y2 the final anchor point.But... I want to give it a _y value instead of a percentage (interval) and it return where on the curve that would intersect.
View 2 Replies
Mar 15, 2004
This is wath my collision function looks like
[Code]...
I have two targets, my question is, how do I use that collision function to check both targets? Should I use an inparameter like ballClass.prototype.collisionDetection = function(target)] and how do I call that funtion from the other movieclips?
View 2 Replies
Feb 13, 2009
I'm trying to work out how to create a simple demo that works as follows: A ball falls from the top of the stage.Player is able to draw a line anywhere on the stage. The ball will bounce/roll along the line such that the player can guide it at will. I don't think the coordinate rotation will be a problem for me but I can't figure out how to transform a line drawn by the player into a hit detectable sprite -- or realkly any way that I can get those line coordinates into my coordinate rotation routine. To keep it simple, I'm just working on the first part of the problem, getting the line to where I can hit test or know its position.Here is my code so far:
package
{
import flash.display.Sprite;
import flash.events.MouseEvent;[code]........
It always traces 0,0 instead of my current line coordinates - and even those I don't think would be sufficient.
View 4 Replies
Jun 11, 2010
Is there a way to check if an event object is == to a sprite. For example
Actionscript Code:
if(evt.target == [object Sprite])
View 3 Replies
May 2, 2011
I think I pressed something in Flash and now none of my images are showing up in the workspace. Only the bounding boxes are showing up.
View 1 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
Apr 4, 2011
I've got a sprite which I want to temporarily hide... But changing the .visible property doesn't do what I expect. The code looks roughly like this:
[Code]...
View 1 Replies
Jul 6, 2011
I'm doing a simple rotation on a sprite but there's a weird behavior where the sprite does not rotate around it's top left. I think I'm rotating along the top left of the test class instead of the sprite child. I would like to rotate the rectangle around it's top left corner (kinda like a clock hand). The code is pretty short so I'll let the code + pictures explain my problem:
package
{
import flash.display.Sprite;
[Code]....
I've read a lot of stuff about rotating around a fixed point, I've tried doing it with movieclips instead of sprites, I even copy pasted a tutorial on rotation and nothing works.
View 3 Replies
Jan 17, 2010
I'd really like to be able to make Flash's array access syntax 'wrap' over the array's bounds.
Lengthy explanation -
var array:Array = ['a','b','c','d','e','f'];
To keep things simple, the first index is 0, and its value is the first letter, 'a'. To get that value, we'd do this -
array[0]; // returns 'a'
As long as the index you're using to access the array is between 0 and array.length (6 in our example,) everything works fine - but if you use an index outside of those bounds, you're shut down.
array[-3];
array[9]; // both return 'undefined'
Sometimes that's a good thing - sometimes you expect that to happen, and you're fine with it. Other times, you find yourself wishing (or at least I find myself wishing) that it'd behave a bit more like this -
array[-3];
array[9]; // both return 'd'
(e.g. a photo gallery that jumps back to the beginning when you click 'next' on the last photo)There's a little chunk of code I use over and over for this sort of thing, but it's always to alter the index before passing it into the array:
var index = -3;
while(index < 0){index += array.length}
array[index % array.length]; // returns 'd'
... and that's fine, but what I really want to do is extend the Array object itself so that it'll automatically 'wrap' index values that go out of bounds.TL;DR - Is index-wrapping possible by extending Flash AS3's Array object?
View 2 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
May 25, 2009
How to attach text to curve or path in Flash CS3 to look like this:
View 1 Replies
Dec 31, 2011
With the select tool, I placed my mouse over the edge & it changed to the little curve sign, but when I dragged it, it just moved the rectangle. Same thing when using the transform tool.
View 3 Replies
Jul 14, 2011
Does anyone know if there is a (preferably efficient :-) ) implementation of elliptic curve cryptography for ActionScript? The only library I know of is as3crypto, which offers great implementations for symmetric cryptography, hashing and several other cryptography-related operations, but it has only RSA for public key cryptography.
View 2 Replies
Feb 23, 2010
I'm building a simple white board app in ActionScript 3. Most white board or painting apps in ActionScript tend to use an interval, timer, mouseMove event, or enterFrame event to track the mouse position and paint lines or brushes in between the tracked points.
What I'm trying to achieve is the nice smooth painted line that a program like Photoshop can render while painting with the brush tool. In Photoshop, no matter how fast you move the mouse around the canvas, the painted lines always end up with a nice smooth curved edge. In my app, using any of the methods mentioned prior, there is always latency between the function calls that render the brush to the stage. Thus, using any of those techniques can result in a sharp cornered line when moving the mouse very quickly in a circular manner.
This is no surprise to me, I just have no idea how I could achieve a smoother line like Photoshop's brush tool. Mind you, the brushes for my app are mostly based on shapes and do not or cannot use the drawing API to draw continues lines. In other words, graphics.curveTo() is not an option. I am also rendering the Sprites or Shapes generated by the brushes to a BitmapData instance.
View 4 Replies
Mar 23, 2010
I need to implement a drag and drop functionality, where I can define and constraint the route of the draggable object.[URL].. only that i have the paths designed and not calculated by a math function. So, in fact, as mouse moves I need to tell the object to follow the custom path/movieclip.
View 1 Replies
Aug 22, 2011
Is there a way we can apply curve to an dynamic text which is in vertical direction?
View 1 Replies
Aug 13, 2010
public class Greeter extends MovieClip
{
public function Greeter()
[code].....
View 3 Replies
Apr 9, 2011
I want to use numbers I've drawn myself to represent a number, but don't know how to implement this. How would I display the equivalent of an integer with these numbers? If it's necessary to have them in a tile pattern, which makes sense to me considering how older games worked, then what code would I use to switch between each? Or is there another, better way? Also, I need the number to be able to adjust to the number of digits in the number and read from left to right (so the 1 in 10 would be in the same place as the 1 in 1).
View 2 Replies
Mar 17, 2012
I'm playing with Open Flash Chart. Take a look at this chart: [URL] As you can see, the rounded dot points look ugly. Some of them are more rounded, some of them less, they don't look the same, as they should. I don't know AS3 and have no idea what is the case. I checked the source code:
[Code]....
View 1 Replies