I dont think that will work. I need to have it as individual blocks.I did a quick demo file to show what I need. You will se in the file that the map is randomized and I need it to be like that to! READ THIS: I want the green cube to fall down (gravity) and than "land" on the gray cubes. This is a small demo, of my full version flash file, so i need it to be blocks.
I am having trouble having an external Class detect when it collides with an object that I have added to main stage. I have physically placed a MovieClip to the stage and given it the instance name of "hitZone_left". When I publish the files I get the error: "Access of undefined property hitZone_left".
i have a flash file with a number of movieclips in the library - various bubbles that can be popped at a clilck. The fla has a document class - BubbleGame.as, and the various bubble mcies in the library are all exported for action script, (using their own names, but) with a mutual Base Class - BubbleBase.as, in order that all the various bubble movie clips have the same behavior: load in a random position, play out their own timelines, be popped when clicked, and if not popped - reload in another position.
This is all working very well, however, I want the movie clips removed if they hit an object on the stage. The object has an instance name of sym_mc, and I have tried various bits of code to cause the bubble to be removed when it hits that object, but i either get errors or nada.
I tried doing the hitTestObject code in both the document class and the base class. It seems more appropriate to have it in the base class - BubbleBase.as (below), because that tells the bubbles what to do.
In my program, the movieclips are randomly added on the stage, If I want to check whether two movieclips from different classes is colllided.As far as all the moveclips are of the different classes which are randomly added on the stage in my program,for the use of hitTestObject(), I find that I need to have two movieclips identified so that the command will be:
mc1.hitTestObject(mc2)
maybe I may ask, before I add a mc on the stage "addChild(mc)",I will call a function to do the hitTestObject command "mc.addEventListener(Event.ENTER_FRAME, hitTest)"so that I can call evt.target to be mc1, is that true or not?
Im've created a timer that starts every 1 second. This is the code what's happening every 1 second.
var Random_Value_X:Number = Math.ceil(Math.random() * 1500); var Random_Value_Y:Number = Math.ceil(Math.random() * 2000); var enemy:MovieClip = new AI(stage); addChild(hero); enemy.x = Random_Value_X; enemy.y = Random_Value_Y;
Ok. Then I got the class called AI where I've made it so the AI follows my player. The thing is, I need to make a hitTest that testes if an AI hitting another AI? Is there a way I can give every new AI a ID? Like the first gets called "AI1" and second AI2" and then I can make a code that says like If(AT1.hitTestObject(AT2 || AT3))
I am trying to develop a basic game engine for a slime soccer style game where a player can move around and jump. I am still fairly new at AS3 but managed to put together this working bit of code that the game currently runs on:
Code: stop(); //vardefs var runSpeed:Number = 10; var blueGoals:Number = 0; var redGoals:Number = 0;
I have a project with four circles moving randomly on stage (ball_mc1..ball_mc4). There are four walls making a box (wall1..wall4).I've created arrays for both myCircles and walls.When myCircles hit walls, I would like to change the direction of myCircles depending on which wall they hit.
stop();// walls or limits and their arrayvar walls:Array = new Array (wall1, wall2, wall3, wall4);for (var j:Number=0; j<walls.length; j++); // circles in arrayvar myCircles:Array = new Array (ball_mc1, ball_mc2, ball_mc3,
I have section of code which works for bouncing some fish movie clips off of the 'ceiling':[code].....
However, I would like to find a more succinct way to program this using a 'for loop'. I tried the following, which did not work and gave me an error (posted at the bottom). [code].....
TypeError: Error #1010: A term is undefined and has no properties.at Function/<anonymous>()
Im trying to get Flash to rember if the logo_mc has been hitTested with the holder, and if it has when the movie is played again it appears in the box and not the original spot
var mySO:SharedObject = SharedObject.getLocal("ObjectPlace"); var logo_mc:Sticker = new Sticker ; addChild(logo_mc);
How do I get the x,y position of hitTestObject? Since I want to obtain the x,y position where the hit test occurs and add a movieclip on that specific point....
I am building a pacman style game, and I am looking to shorten my code.The stage contains 92 instances with instance names of food1, food2, etc.When the player(pacman) hits one of the instances Im wanting to call a funcion.I started writing it out like this... it works but I don't want to duplicate this 92 times!
I would like to make a button that allows you to go to the next frame. I would like to do this with hitTestObject. When the charecter walks over the button, you should go to the next frame.
I'm hoping someone can help me. I'm trying to add sound to the hitTestObject script below so that a short sound plays everytime "bolt" hits the ralphie_mc.
I'm working on a scene where the user can drag sugar, honey and syrup flavour to a cup of coffee and each time they collide, the coffee's happiness is increased by 1. I added a TweenLite so that sending any of the objects to their original positions is much more fluid. The problem is that the hitTestObject is now firing more than once (which makes sense and now happiness is increasing at more than one increment at a time) but how can I make it so happiness is increased just once?
Code: public function hitsDecaf(e:Event):void{ if (myCounter.myHoney.hitTestObject(myCounter.decafSweetened)){ ifStartTimer = true; stopDrag(); myCounter.steamHappy.gotoAndPlay(2); [Code] .....
I'm trying to make a simple maze game. I have movement working, and now I'm trying to implement collision. Here's what I have:
An 8x8 grid, with walls of length 1 to break the grid up into a maze. the walls are instances of a movieclip I've named "mc_wall" a guitar-pick-shaped chip I'll control the movement of a cross-hair called "arms" that will check if there are walls immediately surrounding my chip by way of collision. "arms" is a movieclip made up of four individual movieclips: "uparm", "leftarm", "rightarm", and "downarm"
I have currently named each instance of "mc_wall" to be "wall" this is the code I have now (using only right as an example):
function moveRobot(event:KeyboardEvent):void { doslide = true; if (event.keyCode == Keyboard.RIGHT)
[Code]....
this will work, causing the chip to remain in place if the rightarm detects "wall", and move if the rightarm does not detect "wall". My problem is that, although I have named every instance of "mc_wall" to be "wall", the only "wall" flash will recognize is the last one.
Is there a way to adjust this code to look at all 70-or-so instances of "mc_wall" instead of only the last one?
Ok I am building a DnD, I have a hitTest setup, and I know when it hits it. But I can't get out of the for statement if I drop it on the second object. It says it hit it, and then anims back to org. place.
Code: public function onStopDrag(evt:MouseEvent):void { stopDrag();
Press the picture to get it larger. That's what i really need for my project. I can't get it to work.please explain it for me to, im learning flash so I can need that to understand sometimes
I'm creating randomly moving boxes. And when one box touches another one something happends. The code below is something i've done but the problem is that when the for loop goes trought the array the box hits itself.[code]
I have a project I am working on in Flash CS3 using AS3.I have a drag and drop quiz that contains 8 boxes. 4 of the boxes contain dynamic text boxes with the vocabulary words. 4 of the boxes contain the definitions to the vocab words. The students drag and drop the vocab words onto the definitions. My issue is that hitTestObject is only working on the first box everytime. I have a for loop in my endDrag code that should loop through each object and test against it to see if there is a hit. Can anyone see anything wrong with my loop?
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?
Before i ask what im sure will be a very silly question, let me say that i am a total beginner at Action Script. I am trying my best to make a simple game for University, and i have tried, but cant figure it out.
Anyway, the game is basically Breakout, where you control a Paddle, and try to hit a ball towards blocks.I cant figure out how to remove the blocks when the ball hits them.[code]...
i am making a game,it involes shooting targets. the way it works is i have a small dot (one pixel) and, when a mouse button is clicked, checks to see if its hitting a target.
in my target.as file i have the following error:[code]...............
I have maze-like game and I'm trying to get the player mc to respond to a collision between the boundary mc.hitTestObject doesn't work since it's not a rectangle. Is there a way to do this?
I have been making a game and have run into some problems I want to make a hitTestObject between multiple arrays, i have tried something like this:
for(var i:Number = 0; i < array1.length; i++) { array1[i].y -= 10; //Moves object up for(var a:Number = 0; i < array2.length; a++)
[Code]....
When i run it, some object will detect the collision and will output "hit", but some will ignore that. I have also noticed that some object in the array1 stop running the move code (array1[i].y -= 10) after i have added another array.
is there an easy way, using 1 or more for loops, to hit test every object in an array against every other object in that array. So I've got an array of 6 things
I have a horizontally scrolling flying game involving a character and diferent types of food moving across the screen from right to left which the character has to collect ("hit"). I have the hitTestObject working for 2 different food movieclips with one item belonging to a healthyList, and the other to a junkList.
how to add more items (movieclips) to each of the lists, so that I have for example 6 items in the healthyList and 4 items in the junkList.
Below is the code in my Engine.as file. The red highlighted text is the code that creates the problem. I thought that I just needed to add this line in order to add another item to the "healthyList" of food types, but I obviously have it in the wrong place or have the wrong code completely.