ActionScript 2.0 :: How To Get Character To Follow Moving Object
Mar 1, 2011
I need to get my character to follow an moving object. I've got an object that's moving around in different directions and I'm wondering how do I get my character to follow the movements when standing on the object ?
View 0 Replies
Similar Posts:
Nov 2, 2010
im currently making an "AS3 beat em up" ala streets of rage or double dragon.Currently i have my character moving and a few animations done and i am trying to figure out how to make attacks work.I have some "basic" animation for his attack, but im not sure how to get it to work correctley.What happens is, if you press control (the attack button) whilst the character is walking he just keeps moving and is stopped on the attack frame.I want the character to stop moving if the attack is pressed and once it is released start moving again.
hero.gotoAndStop('still');
var left:Boolean = false;
var right:Boolean = false;[code].......
View 2 Replies
Jan 13, 2004
I would like my character to move as if he was drunk I am unsure how to do that I am using the keyboard for his movement. I also have a character that moves at random I would like the drunk moving character to be able to catch this character and play a scene from within the drunk characters movie clip but I want this character to try and escape the idea is the drunk character gets points for how long he is able to hang on to this character
View 2 Replies
Feb 16, 2009
im making a platform game at the moment and i need for the screen to follow the character, at the moment i've got the code on the background symbol and all the baddies in that symbol so when you press the arrow key the symbol moves to the side the code i have on this is
onClipEvent (load) {
walkSpeed = 2;
}
onClipEvent (enterFrame) {
if (air == true) {
[Code]....
if anyone knows a way to put this on the camera
View 1 Replies
Sep 26, 2011
im making a platformer with this code...
import flash.events.*;
import flash.utils.*;
import flash.display.MovieClip;
import flash.ui.Multitouch;
[Code]....
And i want to make the screen to follow the character when falling.. for the side horozontally i made the Boundries go the opposite way and keep the character in the center but how can i do that with falling and jumping up off screen?
View 3 Replies
Feb 17, 2009
I am trying to create a character whose head will follow the mouse. I have made a character whose eyes are following the mouse, but I would like the head to turn with the mouse as well - like the cyber pets here.
View 3 Replies
Aug 7, 2010
I have made a simple Drag and Drop map, where its the map being dragged by the mouse. The thing is, i need to have a grid of buttons on this map, which you can click. But since im dragging the actual map, my buttons wont follow. They stay where they are.An example would be the united states world map, then each state is a button i can click. A problem would be that if the entire map is covered in buttons, then my mouse cant drag the background map as im selecting a button when i drag. perhaps i can make the buttons drag the map instead?This is the code for dragging the map:
Code:
Map.addEventListener(MouseEvent.MOUSE_DOWN, grabMe);
Map.buttonMode = true;[code]..........
View 1 Replies
Jul 29, 2004
I followed the tutorial Mouse Trail and ended up with the codes below, but de thing is the whole log of text moving instead of each letters follow the previous one.
[Code]...
View 2 Replies
Aug 11, 2009
i recently learned how to program a tank-type game.. i was able to make the turret follow the mouse and fire bullets that would move to the direction the turret was pointed at..what i'm trying to do now though is make the bullet follow an object moving on stage.. sort of like a heat-seeking missile..
View 2 Replies
Apr 15, 2011
I am currently trying to create an app using flash AIR.I would like to find some more information on how to make an object snap to another ojbect then follow its path, eg. a person object is already on the stage, then drag an arrow to the object which snaps to it, then on play button it follows the arrow path. all in pure actionscript, no guide layers.
View 1 Replies
Sep 12, 2004
what i am trying to do is get the background to move with the characteri checked out a few tutorials.but not enufheres the deal..i have a character that can fly...and when the character goes upward...thebackground moves down to expose sky..then eventually black space with stars...does that make sense?
View 2 Replies
Apr 15, 2002
i posted up lookin for flash tutes to make my game in flash 4 but i guess it's virtually impossible to do so..... well, now i decided to do it in flash 5. here's my concept >
it's basically a game controllling a character to move in grid filled with objects like so >
1 0 1 0 1 0 1 0 1
0 0 0 0 0 0 0 0 0
1 0 1 0 1 0 1 0 1
where 0 (path) is passable n 1 (objects)not....
n i want d character to stand still when not moving and get to an animated frame of it moving when moved in whichever direction. i guess dat's all i need for now. please help me with this as like i've said, i kinda new to actionscripting.
View 14 Replies
Jul 26, 2011
At the first scene of the game My hero character stands still when he's idle but at the second scene he keeps walking in one spot when he's idle. What's going on? Why are the scenes messing with the hero character?
View 2 Replies
Sep 12, 2004
what i am trying to do is get the background to move with the character.i have a character that can fly...and when the character goes upward the background moves down to expose sky..then eventually black space with stars also i want the background to stop..like when the background ends.
View 2 Replies
Aug 17, 2009
i got my character to move left, right, down and up wit this code:
[Code]....
My question is, how can i block the up and down movement? I tried simply deleting some part of the script to block does movement from the user. But then the script would not work properly : s Here is the uploaded page i'm working on: link.
View 2 Replies
Apr 8, 2011
I'm brand new to flash and want to create a character with moving legs. I've created the character with legs, but don't know how to get them moving properly. Does anyone know a good tutorial?
View 2 Replies
Oct 9, 2011
I want to stop the movieclips movement when it hits a wall (another movieclip). The example below works, but after the collision the movieclip 'blocks' all movement to the left...
For now the example with the leftArrow key;
variables to check the key, if it's hitting the walls and if it's moving or not:
var leftArrow:Boolean;
var speed:int = 10;
var hitting:Boolean;
[Code]....
View 2 Replies
Jan 3, 2010
I have a character with multiple animations by way of movieclips, and I'm trying to have it move using the Key.isDown function. Now, my character is moving correctly, but when the key is released, the animation keeps playing. I tried adding a stop command at the end of the walkcycle animation, but that just causes the character to stay frozen on the last frame of the cycle.
Here is the ActionScript Code:
onClipEvent(load) {
var direction = "left";
var speed = 2;
} onClipEvent(enterFrame) {
[Code] .....
View 3 Replies
Jun 6, 2011
I am trying to limit the area in which the character (mcMain) can move I want to be able to keep it in an area (mcBuilding) I also have another area (inwhich the character is not supposed to get to) (mcBackground). (Also I want to be able to to make a dynamic text box that starts at 100 then decreases by 5 when the enemy (mcEnemy) hits mcBuilding and also that it gets removed)
View 1 Replies
Mar 15, 2011
I have a mc called boy and I have an instance of that mc called boy_mc. I have figured out how to make his position change on the stage, but I cannot figure out how to do some other things.
Here is the code that I have so far:
import flash.events.KeyboardEvent;
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
function keyPressed(evt:KeyboardEvent):void{
switch(evt.keyCode) {
[Code] .....
I am trying to learn 3 things.
1. How do I make him be facing left when I push left and facing right when I push to right?
2. How to I restrict him to a certain area of the stage? I am going to have some buildings on the top and I don't want him to be able to walk past the street level. So basically I don't want him to be able to go off the stage or up some to be determined height.
3. When he walks up and touches a door on my stage, I want to jump to another place in the timeline.
View 7 Replies
Dec 13, 2009
I've been struggling with making boundaries with my game. I've managed to make boundaries, but in stead of my game character not moving across that border it just bounces back. Which is not the effect I want.
Here's my code
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
xspeed -= power;
} if (Key.isDown(Key.RIGHT)) {
xspeed += power;
[Code] .....
View 3 Replies
Jan 28, 2012
I am currently working on a platformer using accelerometer to move the character and xml to load levels as so..
[as]
level.x += (e.accelerationX*40);
if (e.accelerationX > 5) {
e.accelerationX = 5;
} if (e.accelerationX * 40 < 3 && e.accelerationX * 40 > -3) {
player.gotoAndStop(1);
[Code] .....
And it is all added into one movieclip called level. My problem is when the character hits under a platform it will go up it which I don't want it too, I don't know how to fix it heres the gravity code.
View 11 Replies
Dec 3, 2011
I'm trying to create simple 2D action game, something similar to well known Fancy Pants Adventures :) I've been looking for answer for more than week and all I've found is [URL] which not answers the question. (I've found also moving on platforms that are rotated but that's not I'm looking for). I have also found great (and free!) flash game engine - CitrusEngine which I'm currently using, but, it doesn't provide moving hero along curved terrain. How to make hero moving along curved terrain like this one: [URL]. There are plenty of games like this (for ex. Fancy Pants or Robot Unicorn Attack) where main character moves along the curved terrain but I can't find answer how can I do that.
View 2 Replies
Dec 4, 2010
I've been searching for a while but was unable to find an answer for my problem. In my document I have two objects -- one that is moving when using the keyboard arrows while the other one has to follow the first one and try to hit it. How do I make the second object approach the first one?
View 4 Replies
Dec 26, 2009
I am using CS3 and trying to get an object to follow the mouse and having a hard time finding a tutorial on this, because all of the ones i have found want me to add the actionscript to the MC, and my version of flash won't let me do that. Flash expects me to attach it to the frame and so the code doesn't work.
View 11 Replies
Dec 25, 2003
I have the script so that you can controle a car with the arrow keys but for one of the missions on my gta2 style game I would like an enemy car to follow you. The car has to stay facing the right way according to the way the street though, this is the only bit I cant think of I also need boundaries.
View 3 Replies
Feb 24, 2010
...without using the startDrag method. I know I can use code like this inside of a mouse event listener/function:
Code:
objectMC.x=mouseX;
objectMC.y=mouseY;
This code makes the object move with the mouse, but only if I move the mouse very slowly. When I move the mouse quickly, the mouse leaves the area of the object and thus the MOUSE_OVER listener stops listening, causing the object to stop.
View 1 Replies
May 18, 2009
I have this kind of menu structure design (see image attached), and the way It needs to work is when the mouse goes close to a topic it follows it and when the mouse is a certain distance away it springs back to its orginal place?
View 6 Replies
Dec 10, 2006
basically im trying to set a bitmap to follow an object i have.heres some code...
Code:
override public function paint():void{
super.paint();
if(imageLoaded=false){
trace("loading image...");
[code].....
all the stuff in the loadImage() used to be where loadImage is called and it would run but would draw the image over and over leaving a trail so i moved it so it would only draw once but now it wont even work, tells me "Error #1009: Cannot access a property or method of a null object reference." which reffers to "mBit.x = super.px;".
View 1 Replies
Mar 12, 2002
1. Need to be able to allow movie_clip2 to detect movie_clip1
2. Allow movie_clip2 to follow movie_clip1 only in the _y axis
View 10 Replies