I'm trying to create an animated 'LED style' display. I want to draw/tween/type shapes or text and have the 'LED dots' detect the animation and turn on the relevant dots.'ve been testing the hittests but it slows down pretty quickly and the problem with the hitTestObject is that it obviously just detects the bounding box, NOT the vectors.
I have two png files, a circle and a maze. Basically the maze is a square with some paths carved through it. I want to draw these images, move the circle to the mouse coordinates, and have a text say 'hit' when the circle intersects a wall of the maze and 'miss' when it doesn't. Now I want to do these using the bitmapdata.hittest method. The circle is a 32x32 image and the maze is a 256*256 image. I've gotten everything set up and everything draws on the screen correctly but I can't get the actual collision detection part of it to work, that is it always displays 'miss' rather than 'hit' even when the circle clearly intersects the maze.[code]
Im currently working on a demo flash game built on AS 2.0. im a very beginner to this flash and AS and im stuck up with a very silly concept though im not able to overcome it. the problem i have is with collision detection ie hit test and im really struggling with it.
Its been many years since I've used flash and I was just wondering what the easiest way to do collision detection was now. I know that there was some hit test bounding box stuff present earlier but I don't know the capabilities of flash cs4 and the advances that have been made. Google searches have yielded things like complex pixel-perfect collision detection but not a lot seems to have been written about CS4 yet.
I am trying to get some collision detection working. What I have is a ball moving around the stage. There is a box in the middle which when the ball hits, I would like it to bounce off the box. I can get the x axis working fine using hitTestObject but when I detect for collisions on the y axis, the two axis conflict. Does anyone have a way of doing this properly?[code]
HitTestObject seems to check collision of bounddaries of shapes, it seems to consider everything rectangular. Also if one object jumps two pixel and other five pixels on EnterFrame it seems like there won't be any hit detection. Seriously guys what else method do you use, if you use hitTestObject how do you use?
I'm making small interactive games in flash to learn AS3,I need to check the collision between the player and the wall which is normally simple using the hitTestObject function.But now I made a wall object totally surrounding the player with corridors and turn, a collision playground so to speak. Now when I use the hitTestObject function to check whether the player is in collision with the wall it tells me it always collides supposedly because the player object is within the bounds of the wall object.So assuming that I'm correct about the error:How can I prevent getting a collision when I'm inside the bounds of the wall object but not touching the actual walls in that object?
I'm trying to make a game like Mario. I've made a character which can jump right now, but I've got some problems with collision detection.
I would like my character to jump on a bar, which is placed higher. My collision detection doesn't work at all I gues..I've made a cirle which has a instance name mcMain and I've made a MovieClip of it. T also made a rectangle which has a instance name balkje, I also made aMovieClip of it.
I hope you can tell me what is wrong about my code and what I've to change to make the collision detection work!
I have Object "A" that moves around and collides with other objects. There are hundreds of other different objects it can collide with. The only way (I found) to test for collision is to loop through every other object. That seems rather inefficient considering I don't even know how many objects exists. Other objects are constantly created and deleted. So this loop would be rather complicated.Is there a way for object A to receive what other object it collided with so that I can then do some code on that other object. Any way to avoid looping? I later need to find out how to detect what objects are near (within x pixels or so) of object A to decide with which one to interact. Maybe that could also be used now to limit the test of collision? Or maybe it gives someone an idea of what to try?
I am in the process of building a project in which several MovieClips "swim" around semi-randomly, and another MovieClip that appears and expands over the mouse on click alters the frequency of the turns. Do do so, I simply need to change the value of a single variable on the first MovieClip's timeline when the two collide. I am using hitTestObject, but I keep running into errors. The expanding MovieClip does not have an instance name, because it only appears when the mouse is clicked, and quickly disappears.
I am receiving the error 1067: Implicit coercion of a value of type Class to an unrelated type flash.display.DisplayObject My code causing my first MovieClip to "swim" is on that MC's timeline, while the rest of the code is on the main timeline.
I have this problem: I am making a game with flash cs5, and i am coding in as3 i have written some code, that spawns an child (a fireball) from the character position. i made a movieclip symbol on my main scene, that mc is the "parent" for all the enemies that i am adding but now i need to detect the collision between an enemy child and a fireball child, does anybody know how to do that? if asked i can post some parts of my code
I need help with one of my Flash projects,I'm trying to use gskinners shape based collision detection, but for some reason I cant get it to work, but im pretty new to using classes, so I dont understand the structure too much. Can i get a tutorial on how to use the gskinner class? im using the as2 version.heres the code, bare with me, there's a lot here. in all codes, mc1 is the track outline MC, and mc2 is the car
basicly im making a 2D top down version of WipEout HD Fury, so file structure is something like this (the .fla is called wipeout as3 because i was initialy coding in as3 and never changed the filename).wipeout as3.fla (the flash file containing all the MCs and animations, but only enough coding to import all of the external code files, as well as the VCam and its script) the code is;
Code: Select all #include RaceControl.as"
the RaceControl.as is used to determine the Car's control scheme, and refers to a physics code called RaceCar.as. i found it on the interwebs, all credit to matt carpenter;
Code: Select all// Race control
// Create key listener[code]........
the Bounce Function is my own work, and is what i want to happen when a collision is detected.now, the movieclip used for the car is my own drawn design, as is the track, and i want to use GSkinner's shape based collision to detect the collisions properly. so far i have the car driving around quite happily but i need it to collide with the walls of the track, rather than drive right through them.
Im trying desperately to learn figure out how to get the collisons working with the blocks.it works on some blocks some times. Ive tried everything I can think of!testBlocksCollisions() is the function that wont work. I have a clip called ball on the stage a clip called bat and block1-9 on the stageu could also explain where I was going wrong that would be immense.this is my code
I was wondering what classes do you use for good collision detection for games and similar, I have used Corey Oneil's CDK (Collision Detection Kit url... and an as3 port of the Grant Skinner method (url...) but here's the issue, with the cdk the problem is that I'm using flashdevelop and the compiler is kind of strict so I have to rewrite a lot of thing that function in the normal flash compiler, the gskinner port has a problem about some null object reference.I was wondering if any of you could recommend me some classes or tell me how do you handle your collision detection.
I have a collision detection working so when I drag an e.target on a button a flv loads externally onto the stage, but the flv keeps adding to the stage repeatidly. Is there a way I can drag the the e.target onto the button that the flv will only add to the stage once, even though the e.target remains colliding with the button?I cant have a MOUSE_UP event listener as I already have an ENTER_FRAME listener within the if statement.
EDIT :The thread has transitioned into [3d collision detection with as3 ] - check last post I'm in the making of my molehill game, and have now approached a little problem: I have my Terrain and my Mesh(character model). Moving/walking the mesh around was simple enough (X,Z). But when i added elevation to the terrain, i have to add movement in Y depending on the Y pos of the terrains vertices. My terrain does not have a fixed grid, and eventually might not have equal amount of rows per col. The way that i receive the verticeData is through one long vector.
I'm having a bit of trouble with psuedo 3d collisions using spheres. I'm using _xscale and _yscale to emulate the z-axis (no horizon point), and am having trouble determining the distance between the objects on the z-axis based upon their relative scales. I'm not concerned at this moment with creating new vectors based upon hit angles, just getting the z-index collision detection working.
(I also need to tweak the code to prevent trapping, so much todo) Here's the code, the issue is how do I determine the correct value for the z-axis in the hittest? note-this only works when I publish in flash6 when using mx2004, the collision detection doesn't work at all when published for flash7?!?
I'm making a basic platformer to familiarize myself with AS3. I'm currently having an issue with the HitTestObject and HitTestPoint methods. Currently my game consists of a character who can run and jump, and a box which should prevent him from falling. I have two questions (the complete code is attached and is only briefly referenced in the questions):
1) Why is my HitTestObject broken? The issue I'm having is that when I perform box.HitTestObject(character), the screen shakes in most of the character poses (i.e. facing left or right) but not when the character is crouching. I suspect this is because the bounding box in the different frames of my character movieclip are not the same. Is this the case, and how can I make certain my bounding boxes are exactly the same across all frames?
I have a serious problem with Action Script. I'm about to code a new Jump&Run game with a simple gravitation Engine. And this is where I got my problem I can not solve! When moving the player through the levels, I want to move the layers instead of him. So the player stays somehow where he is but the enemies, ground, items ... move around - as in most of these games. The gravitation is intendet to affect every item/enemy (by ENTER_FRAME) and moves every object downwards until it hits the ground.
The problem is, objects of different Layers somehow don't get the right hitTest information. So when having two objects - the first on the same layer as the ground, moving both, everything is fine. But as soon as I put the object into a separate container like "itemsContainer:MovieClip" and I move that, the object doesn't get the right result for hitTestPoints. (Maybe it has something to do with localToGlobal??)
I was told the pixel detection is costly for regular windows games. Is this the same for flash ?? Or would pixel detection be lighter compared to other detections flash has to offer. Flash has the getPixel32 method which makes it easy for detecting pixels. If I am bliting my game, would it be wise to use getPixel32 for collision detection. Or should I just check for specific tiles?? Is getPixel32 limited to the display object it is in ?? In other words, can I detect any pixel regardless of what layer it is on in the display list.I probably can figure this out on my own but I want to ask first to save me some time. But does anyone have any code or good sources on how to go about doing this if it is reasonable.
I'm starting to understand ActionScript and getting better with it. However, I'm building a platform game with an unlimited length. What would be the best way to create the "block" the player is jumping on?
Of course collision detection for these movieclips is needed (nicest would be to do it without a giant loop through an array, etc. on every frame). There's probably something like 5 block on the screen at the same time.
I am creating a scheduling application that shows projects (wrapped within a canvas) on a 2 week calendar timeline.If the user decides to move a project over by a day, i need to check and see if the moving project would then overlap with any other existing projects. If it does, one of the two projects would need to move down the screen along the y axis until the two projects no longer overlap.I've created a function that loops through a repeater item which is used to create the projects... the end result of this function is an arrayCollection that holds:
0. the id number within the repeater
1. the project title
2. x coordinate
3. y coordinate
4. the width of the project
5. the height of the project
I have also created a function that takes the two objects within the array collection and determines if they're overlapping.I can not, however, figure out a working loop that goes through the array collection, compares each item within it, checks to see if they overlap, moves the project if they do overlap, and then continues onto the next project.
Also, I need to make sure that moving one project will not make it overlap with another.I ended up having to reset each elements y value to 0 each time any project is moved and then re-evaluating whether or not they collide.
I am in the progress of making a Flash game and currently I am doing the coding for collision detection. The collision detection will be for detecting if the player is running into obstacles, and if the player runs into the obstacle, then it will stop him from running through it. Here is my code that I am using for collision detection: