Actionscript 3 :: Make Character Face Direction?
Jan 21, 2011
I have one character which can face several directions: t, b, l, r, tl, tr, bl, br.The type of camera is top-down 2d
T stands for Top, which is when he is looking to the top of the screen
B = Bottom
L = Left
R = Right
The character can look to other directions, like the Top-Left of the screen, which is tl
How do I calculate which direction he should look to if I only have one variable, rotation?
View 1 Replies
Similar Posts:
Dec 24, 2011
How would I go about doing this but not directly like 360. like lets say my mouse is to the left of the character the character would than face its left frame I made for him like lets say his left frame is frame 2.
View 8 Replies
Jul 8, 2011
I wouldn't think this to be a very difficuly question to find a solution to. My question is; I have a movieclip with instance name "player" and I am trying to layout it's basic movement properties. I already have made it so that the mc will move up, down, left, and right. Cake. What I am having trouble with is getting the mc to rotate in the designated direction (right = 0 degrees, up = 90 degrees, etc).
I have tried using the xscale 100/-100 strategy, but that doen't do anything for up and down movements.
My code so far is as follows:
Actionscript Code:
playerDirection = 0;setInterval(function () {if (Key.isDown(Key.RIGHT)) {setDirection(0);_root.player._x += 3;}if (Key.isDown(Key.LEFT)) {setDirection(1);_root.player._x -= 3;}if (Key.isDown(Key.DOWN)) {_root.player._y
[Code].....
View 4 Replies
Oct 5, 2011
Working on a maze game. When the leftkey is pressed the movieclip (char) should turn 90 degrees to the left.
char.scaleX *= -1;
However, the most important thing is that the character doesnt go through the walls of the maze.And I think thats my problem for implementing the code above.Because it doesnt work properly when i put in here;
if(!mazehit) {
char.y += speed;
char.scaleX *= -1;[code].....
View 1 Replies
Feb 24, 2011
I'm trying to accomplish something with flash but I'm having some problems, if not a solution I'm hoping someone can tell me a method and what I should read up on to do this: I want to have an image on the stage that has a gap the shape of a face in the middle of it, I'd then like to put a webcam feed behind it so people can line their face up in the gap and press a button to take a picture. (I've managed to put the webcam on the stage and take the picture but can't work out how to put it behind an image). Then I cant quite work out how I'd put the face onto a character I've drawn.
View 1 Replies
Feb 15, 2010
I'm making a game that is birds eye view like the old grand theft autos. anyway im currently stuck at this... I can have my character fire and have the bullet follow my mouse but I cant seem to figure out how to just make the bullet go straight off the screen in the direction my character is facing.
View 2 Replies
Sep 20, 2010
I'm making a game that is birds eye view like the old grand theft autos. anyway im currently stuck at this... I can have my character fire and have the bullet follow my mouse but I cant seem to figure out how to just make the bullet go straight off the screen in the direction my character is facing.
View 8 Replies
Oct 20, 2011
I tried almost everything to make my character stop when it detects a wall. It only works for UP and RIGHT or DOWN and LEFT but not all 4 directions, so only one y movement and one x movement. So I decided to make 4 functions, one for each direction. But then it only works when the left key is pressed and hits a wall.
What do I have to do to make the collision detection stop the character from moving in all 4 directions?
var leftArrow:Boolean;
var upArrow:Boolean;
var rightArrow:Boolean;
[Code]....
View 2 Replies
Mar 2, 2012
I'm working on a side scroller that has a character that fires a bullet every time you hit spacebar, the problem I'm having is moving the bullet in the direction the character is facing (left or right).
I have a few of boolean variables to tell me which direction my character is facing: walkingRight | walkingLeft, so if my walkingRight == true, I want the bullet to travel +=10, and walkingLeft == true, bullet -= 10.
The problem is, when I fire facing left, the bullet moves left, but as soon as I turn right, that same bullets starts moving right.
Here is a snippet of AS3 code (Every Frame):
if(gamepad.fire2.isPressed){
// initiate bullet
var bullet = new Bullet();
[Code]....
View 1 Replies
Sep 17, 2010
I have this code to add my missile to the screen PHP Code:
[Code]...
it adds right where my character is but I cant seem to figure out how to get the missile to actual move in the direction the character is facing. heres how it looks [URL]
View 1 Replies
Aug 11, 2009
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.
View 2 Replies
Jan 13, 2009
Few days ago I uploaded my flash face morphing application and now I'm thinking of writing an article about creature process.URL... anyone curious about how I made it?
View 5 Replies
Aug 16, 2011
I have my as2 code for my game im making so far the char can jump and move left and right. make him face the mouse like lets say my mouse is to the x- of my character than I would want his left facing movie clip (which I havent made yet) to be facing that way etc. where I could start heres what I have:
Actionscript Code:
onClipEvent (load) {var ground:MovieClip = _root.ground;var grav:Number = 0;var gravity:Number = 2;var speed:Number = 7;var maxJump:Number = -12;var touchingGround:Boolean = false;}onClipEvent (enterFrame) {_y += grav;grav +=
[Code].....
That's the movement code that lets me move left and right and jump with gravity
View 2 Replies
Dec 19, 2009
i want to make the character in my flash game make a jump when the player presses a key,e.g. 'space',even the player release the key instantly,the character will still finish the complete jump process.
View 1 Replies
Feb 24, 2009
i have a scroller developed in as2. it basically scrolls continuously in a direction until the direction of the mouse is changed. the images of course loop in the continuous scroll. now the problem is that for 10-15 photos its ok. but when i feed it with 180 photos, it seems to show only 11. why would this be? any restriction on flash ??
View 1 Replies
Oct 15, 2010
what i am trying to do is make a circle turn and act like a wheel... what code would i use to make a circle turn and move in the direction it is turning while on the ground?
View 12 Replies
Sep 7, 2011
is there a easy way to make an object move along the x axis in one direction then when it reaches that direction it moves back. with a smoove movement.
View 1 Replies
Jan 22, 2009
I have found scripts to make them face the mouse, but when I try to tweak them to face another movieclip, they don't work.
For examples purpose make the MC: arrow face the MC: target.
View 14 Replies
Mar 17, 2011
have a ball with the name of mc which can be moved using the keyboard .. when you press the left mouse button shoots the ball, this ball and the other flies in the face where the cursor was in the shot .. but if you move the cursor to another location and shoot a second time then the second ball is also flying in the direction of the cursor and the first ball change direction toward a second shot ..
ActionScript Code:
import flash.display.MovieClip;
import flash.display.DisplayObject;
import flash.events.MouseEvent;
[Code]....
how to make that first ball did not change its direction and continued to fly in the direction of the shot?
View 5 Replies
Jun 26, 2010
So I'm making a platforming game, how do I make my character have a different animation for when he runs or jumps?
View 4 Replies
Jul 31, 2011
how would i make a level that follows the character? would it be a on enter frame event?
View 13 Replies
Feb 5, 2011
I got a curve(e.g. movieclip) which i want my character to go on when i press left/right arrow. How to make that?
View 2 Replies
May 12, 2010
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.
View 1 Replies
Nov 14, 2006
I am creating a game in flash using spirte sheets of megaman and I have a problem setting up script to make him jump. I am able to have megaman run side to side and also shoot but I can not get him to jump. Here is a sample of my code:
var hspeed = 0;
var vspeed = 0;
var i = 0;
[code].....
View 3 Replies
Oct 12, 2008
How would i make an enemy bullet go towards the main character?
View 7 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
Jun 8, 2011
I want to know how to make a character attack in a game. I've made a platformer game in which a character moves and jumps and collects the score balls, but the only thing I can't do is make him hit enemies.
View 1 Replies
Feb 12, 2012
I want to make a fighting game with my own character skins and those of my friends as a fun thing.I'd like it to have an intro, menu, character select, level select. I'd like the levels to be able to scroll and for the characters to have health metres. So what I am looking for is either a tutorial to build this up, or be able to look at a completed one and take it apart. I'll be able to handle the art on my own.
View 4 Replies
Aug 10, 2011
how do i make my animation not fall of the stage when i make it move with they arrow keys?also how do i make my character jump when i hit the space bar using actionscript?
View 1 Replies
Mar 25, 2010
I have a 2D game (top down), and I would like to make the character escape from a shot, but not just walk away from the shot (I mean, don't be pushed by the shot), I want it to have a good dodging skills.The variables are:
shotX - shot x position
shotY - shot y position
shotSpeedX - shot x speed[code].....
View 2 Replies