ActionScript 3.0 :: HitTestObject - Character To Walk Down The Screen And Hit The ObjectWall And Then A Movieclip Gets Added To The Stage
Apr 13, 2012
i want my character to walk down the screen and hit the objectWall and then a movieclip then gets added to the stage and plays but it doesnt seem to work and ii dont know why.
I am making a walk and jump game. My game would work by the character standing in a fixed place and when I press the left key he would appear to walk left but the background actually is moving right. And when I press the right key the background would move left making the character appear to move right. Now I would also like the character to jump when I press the up key. Now I have created a walk cycle in a movie clip and have a jump cycle that I could also use for the jump.
im having a bit of an issue with making a character walk to a position when the area is clicked (but i dont want them to move on the y scale, just the x). i dont want them to instantly move, i want them to (flip over if necessary) and play their walking animation as they walk to the clicked position.
Using AS2, how can I have a character movie clip walk along a line/curve without falling through it? By this I mean the character could say, walk over a hill whilst jumping (falling back down due to gravity physics) but would not fall through the curve that represents the hill.An example of this would be BMX star or BMX backflips and any game that is a side-on view of a character walking.
I have my movie clip walk off the left side of stage and come back on the right of the stage. but I cant get it to walk off the right and come back on the left can any one give advise please. this is what I have so far
onClipEvent(load) { var direction = "left"; var speed = 10 ; }
I don't work with the Flash IDE very much, and I'm running into a problem with the unreliable creation order of components instantiated by the Flash IDE "magic".
Basically, I have to call a function on a loaded module. This function should only be called after all the module's children have been added to the stage.[code]...
I have a movieclip which is added to the stage every second at a random place.i want all instances of this movieclip to move to the postion x=100px and y=200px on the stage at a rate of 5px.im not sure how to code this, i would like the code to be in as3 if possile as i do not know as2.
I am currently having problems referencing a MovieClip child which I add to the Stage from the Document Class. Basically when the MovieClip child is added to the Stage from the Document Class, I want a certain MovieClip already on the Stage to reference it once it is on the Stage.
Also, if it is possible, I don't want the MovieClip referencing the child being added to the Stage to have parameters linking it with the Document Class, because I plan on nesting this MovieClip within another MovieClip later on in the future.
Here is the code for the MovieClip class which is referencing the child once it is added to the Stage:
[code]This is called as part of the die() function I've created for an enemy in the small game I'm making.The idea being that when the enemy dies, it attaches a movieclip of an XP orb.And it does this perfectly well.The issue is in the last bit of the code.I'm attempting to call the setType() function within the class that the XP orb is in.However, it isn't setting the type to 100.
I want to know if there is a way to add an ease function to a movieclip that has a tween added on the stage already? is there a way to specify the number of frames that I want it to ease? For example, say my tween runs for 25 frames, but I want the easeIn to only last for 5 of thoes frames, and resume it's normal speed for the last 20 frames.
I have a particle generator class and I want to create a hitTestObject function on another object to check for any collisions with the particles produced.I bascially have a character already on the stage called character_mc and I want to be able to collect the particles, that means when the character touches a particle, the particle disappears.
i was wondering if any of you out there could tell me how it is possible to make a movieclip of a character and when the character is dragged about the screen by the curser, how do you make the characters arms and legs swing about in a realistic fashion.
i am wondering from this code, it makes the stage full screen, does it also makes the content of my movieclips scaled to full screen? i have tried this code and it does not seem to do that, how can i make my content to scale to fill a stage's full screen? i have a Movieclip containing a background with a class to make special effects on the background, i am having trouble making the background be "fullscreened" nicely with the stage.
I have encountered strange problem. I have created simple Flash text field control and I wanted to compare its content with some other string. This comparison in triggered when user is pressing the button.In Action Script 2.0 code I noticed that a caret return character () was added at the end of the string coming from the input text field.It is easy to overcome the problem obviously, however I would like to understand what is going on. I use Flash CS4 with AS 2.0.
I have a library swf (asset.swf), it's document class binded to Asset.as, and in the Constructor function of Asset,[code]as known to all, we cannot visit the stage attribute before the display object added to the stage.so, when my loader.swf try to load asset.swf, it throws exception and the loading come to failure is there some one tell me how to load the asset.swf? I cannot modify the asset.swf.
I have a bunch of movieclips linked with bones, with the last bone named chainEnd, and the following code on the stage.
import fl.ik.*; var tree:IKArmature=IKManager.getArmatureByName("chain Link"); var bone:IKBone = tree.getBoneByName("chainEnd"); var tailJnt:IKJoint = bone.tailJoint; var chainPos:Point=tailJnt.position; var chainMover:IKMover=new IKMover(tailJnt,chainPos);
If I set an enter frame event to change the chainPos and then use chainMover.moveTo(chainPos) the chain will wiggle about and generally act like a proper chain. (I use this so that if the cursor touches the chain it will react to it) It works perfectly. So I saved it, exported it and then used a loader to get it into a different file that I'm working with. I figured I could load it in as a movieclip titled "chain" and access the variables through chain.chainPos etc.
This works if I want to for instance trace(chain.chainPos), but if I want to do what was previously possible (react to the mouse) it just won't work. I can check for a hitTestObject for anything on the stage, and I can check for a hitTestPoint against the mouse coordinates, they trace fine, but when I want to actually have the chain move the chainPos and chainMover.moveTo don't seem to do anything. (Interestingly enough chainPos still updates it's coordinates, so if I do chain.chainPos.x += (put number here) and trace that, it will actually change) Anyway, I was wondering if anyone knew why this wasn't working, or could help me get this functional. It's a massive pain to have the bones/movieclips on the stage rather than loaded in as a movieclip, so if possible I'd like to avoid that.
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?
I need to create an animated character that can run across the screen. The page(s) are HTML pages and are separate from the Flash file I want to create. The SWF would be used on a bunch of pages.
I have my character movement down, and now I want the create a map. I want the screen to move with the character, and eventually I will have it so that at certain spots on the map, the screen will not let you move and stop and enemies will come out.
I've created a walk cycle using bone tool on a character but i don't know how to make it move from one part of the screen to the other. The character is made up of 6 layers, 4 of which are armatures and 2 have motion tweens.
i want a character to stay in center of screen and where ever we click on the page the character goes there , i mean that click position comes to centre with ease and we can also navigate map like age of empires, or DOTA but in that case character stick at its own position to map.
Im not flash developer so i dont know how to do this but i can do designing. I am attaching a fla with this pls do this experiment with that fla file so that i can understand it easy. Being a non programmer it is tough to understand these things for me. those brown sections in this map would be colusion areas , where we cannot move character and blue is river. so we cannot move character to river too.
I would like to detect a collision between a named MovieClip on the stage and an instance of a MovieClip from the Library which is created dynamically.
at the moment I'm putting all the dynamic instances in an Array and then I loop through all of them to see if I'm colliding with any of them, which I think is not great:
for each (var zz in corridors){ if((map_player.Ndist1.hitTestObject(zz) == true)&&(zz is brick)){ ...
I'd like to remove the loop and do the hit test and do something like
I'm trying to make a fish controlled by direction keys catch some random color shapes thats falling on screen... i made the fish move and the shapes fall but when now i cant do it catch the shapes.. looks like it doesn't make the hitTestObject
I have two movieclips that I would like to interact with eachother (in this case, lets just say its a ball that I throw, and the ground). The problem that I am having is that the ball has its own .as file that determines its gravity and x/y directions depending on mouse position (those values are called in the main actionscript)
Is seems like hitTestObject can not find the Ball movieclip because it is not added to the stage or display list until I click the mouse.
Is there ant way to run a hit test on any child within a MovieClip. I am trying to create a maze MovieClip which contains a number of Wall children. I have an object that needs to know when it hits a wall. This is the code within the object:
package { import flash.display.MovieClip; import flash.events.Event; public class Mousey extends MovieClip { private var Root:MovieClip; public function Mousey(m:MovieClip) { [Code] .....
I have an object that is instantiated, then placed into a property within a singleton (single instance) object. When a button is clicked an event is dispatched carrying a payload that references the display object that is held within the Singleton. When the event is heard, my view object adds the object to the display list e.g. addChild().The Item shows. Now If I hit another button an event is dispatched, and a new item is added to the display list via the method above and is seen. The 1st object is removed from the display list Here is my problem. When I click the button to load the 1st Object the above process is executed again but the object does not show.
I can run trace statements from the object that is supposed to be visible and they run fine. I even do a check to see if the visible property is set to true, and it is, but not object is on my screen. Code for this process.
//custom event carries the name of the page aka display object. this is a string dispatchEvent(new MenuEvent(MenuEvent.CHANGE_VIEW_STATE, event.payload)); //When the event is heard, the following condinial is run
I'm having a lil problem. This problem is i'm trying to get a trurret to rotate to a character on screen...
K, now i know all you smarties are going well thats easy.... and thats cos it is.. i have done that using
Code: public function facePoint(point:Point){ var charPoint:Point = new Point(this.x, this.y) var charpos:Number = FindAngle(point, charPoint) * 180 / Math.PI this.rotation = charpos }
see easy now... i want it so it has (in need of a better description) a max rotation speed. so in stead of the rotation always being the same it has to rotate to keep up with the character..