ActionScript 3.0 :: Top Down Shooter Player - Rotation Equals Direction

May 7, 2011

I am very new to flash, I got a player, and the idea is for a top down shooter kind of thing, I got the player to rotate with left and right, and its rotation equals its direction, now how can I make it move forward in its current direction when I press up?

View 3 Replies


Similar Posts:


ActionScript 2.0 :: [fmx] Travel In Direction Of Rotation?

May 14, 2003

I have a MC(a small army tank) that I can rotate using the right and left buttons. I want to make it move forward when I push the up arrow - The Catch . . . I want it to move in the same direction it is currently rotated. Example: I rotate the tank 10 degrees and then I push the up arrow off it goes in that direction.

View 2 Replies

ActionScript 3.0 :: Choose Rotation Point And Direction?

Nov 11, 2010

I am creating a a small site with a spinning menu but I want it to spin only in onedirection ( clockwise) and around the centre of the 3 point cross I am using as a menu.I have this currently to rotate the menu but I want it to only rotate on way and around centre.

Code:
content_mc.draw_btn.addEventListener(MouseEvent.CLICK,drawClick);
function drawClick(e:MouseEvent):void{

[code]....

View 2 Replies

ActionScript 2.0 :: Simple HitTest With Rotation And New Direction?

Apr 11, 2012

I'm having a bit of a problem with my script. I currently have a square that moves across the screen. There is another square on the stage as well. I want the other square to call a hitTest with the first square (that moves), which we'll give an instance of "hero". The hitTest should make the "hero" (or first square) rotation a specific degree (in this case 30) and then move him in a specific direction, either up, or down the y-axis or left or right on the x-axis. This is my current code, attached to my second square.

onClipEvent(enterFrame){
if(this.hitTest(_root.hero)){
_root.hero.rotate += 30;

[code]....

View 1 Replies

Professional :: MovieClip Smooth Rotation And Direction Change

May 19, 2010

I want to make a movieclip moves smoothly and when it changes the direction, it can turn smoothly but not a sudden turn, I try out the code below. and the truning is odd:
this.rotation = (Math.atan2(targetY-this.y, targetX-this.x )/Math.PI)*180;

View 2 Replies

ActionScript 3.0 :: Calculate The Total Rotation Of An Object In Either Direction?

Jan 27, 2010

How to you calculate the total rotation of an object in either direction?

I need to end up with a number of total radinas(or degrees) that is posotive or negative depending which way the object was rotated.

View 4 Replies

ActionScript 3.0 :: Flash Converting A Rotation Angle To A Direction Of Motion?

May 1, 2011

I have a rotation value in degrees(0-360) and a value for magnitude, ie (1-10 pixels per second).

How to apply this information to determine what to add to an objects x and y values to send the object off in a given direction at a given speed ?

View 8 Replies

ActionScript 3.0 :: Working On A Basic, Horizontal Shooter Platform Game - Make Enemies Move Smart, Towards The Player?

Oct 3, 2011

i am an newbie as3 developer, and i am working on a basic, horizontal shooter platform game.and my question is: how can i make enemies move smart, towards the player? ( but ofcours you are in able to dodge)so like, an enemy is moving to me so when i am not dodging, it will hit the player.

View 2 Replies

Player Face Direction Using Arrow Keys?

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

ActionScript 3.0 :: Detect Rotation Of The Player?

Sep 21, 2011

I have a platformer engine. Which i can draw out the level. But if the player is moving up hill I want it to rotate according to the angle of the boundaries.

how this is done. I think I read up something abou PI? maths im ok at but this is quite confusing.

Here is my hit test code on the boundaries if it helps.

private function processCollisions():void
{
//when player is falling
if(_vy > 0)

[Code].....

View 19 Replies

ActionScript 2.0 :: Scrolls Continuously In A Direction Until The Direction Of The Mouse Is Changed?

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

ActionScript 3.0 :: Direction Of The Ball In The Direction Of The Mouse

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

ActionScript 3.0 :: Object's Y Equals Placement Of Another Mc?

Jan 31, 2012

looking for the correct way to arrange this. So this below works. But instead of using the y coordinate of the wst, wsa, and wsm, is it possible to have it equal the mc itself? so wsa1.y==wsablank3(mc)

[Code]...

View 1 Replies

ActionScript 3.0 :: When This.root Equals Null Or Not

Oct 16, 2009

I have some confusions on root and the stage classes; like;When should I use root or the stage class, from within my custom classes, in order to access the existing objects on the main timeline.When is this.root == null or not!How can I check numChildren on the main timeline.

View 8 Replies

Arrays :: Tracing Object Whose Property Equals To Certain Value

Mar 29, 2011

I have an array of objects. What I would like to do is get the last index of an object whose property equals a certain value.
Ex:
// this occurs on a mouse click
var stockObj:Object = new Object();
stockObj.ID = "an_id";
stockObj.category = "a_category";
array.push(stockObj);
//psuedo
trace(array.lastIndexOf(stockObj.category=="a_category"));
I would like this to trace the index of the object whose category property equals "a_category"

View 2 Replies

Actionscript 3 :: Flex Localization Equals Character?

Jul 14, 2011

I'm having problems placing an equals character in my locale file.I have to do something like this:

#greater value

greater_value = the value must be ( >= ) than the corresponding value

but when the thing is displayed in the ui the text after the second equals is missed.how do you place an equals character in a flex locale file?

edit: I have already used, escape characters, ascci code, html codes and unicode unicodes.

View 2 Replies

Actionscript 3.0 :: MC's Transform.matrix Equals Null?

Nov 10, 2010

I am having quite a bit of trouble with one of my classes not working with the custom PixelPerfect-Class. Looking into it I found the error occurring in this line:

Code: Select allbM:Matrix = objB.transform.matrix.clone();

It's throwing a 1009. Playing arounf with trace I have come to the point, that the hero in my little game has no transform.matrix (it's null). This is not related to the CollisionClass, i traced it independently of that.

View 2 Replies

ActionScript 2.0 :: Text Value When Hover_n Equals Different Intergers?

Mar 8, 2005

I need the img_n variable below to be equal to a text value when hover_n equals different intergers.

img_n = ("i"+hover_n+"_caption");

For example, if hover_n=23, then img_n = i23_caption;

Is there a text equivalent to eval() or something that can return this value?

View 4 Replies

ActionScript 2.0 :: Eval Usage On The Left Of Equals?

Apr 1, 2007

I'm sick of writing long scripts or being locked in certain cases to not being able to use dynamic features because I don't know how to use things like eval on the left side of the equalsHere's an example

Code:
base.mitem1y = mitem1._y
base.mitem2y = mitem2._y

[code]....

View 3 Replies

ActionScript 2.0 :: Loop Through Array Checking Every Item Equals True?

Oct 27, 2009

I have an array. I have a button, when I press on it I want to be able to loop through every item in the array and see if EVERY item is equal to true, if so I want something to happen.

var allIsTrue = false;
_global.myArray = [false, true, false, true, false, true, false, false, false, false, false, false, false,false,false,true]
///would not do something

[Code].....

I thought I could loop through each one and if a false statement if found, the loop stops and the variable allIsTrue = false. But if the loop cycles all the way through allIsTrue = true.

View 3 Replies

ActionScript 1/2 :: SelectedItem.data - Change Variable Kolko[i] To Equals Combobox Name

Dec 5, 2009

i have online game and i have to know how to do this easy thing i have inventory and under things like first aid is number of objects and its combobox and after change i want to change variable kolko[i] to equals combobox name : "co"+i and that selecteditem data , i have this

[Code]...

View 9 Replies

ActionScript 3.0 :: Rotation Center Is In Left Of The Image - Aren't 3D Rotation From Transform Panel

Jan 7, 2010

I have a movieclip and when I do 3D rotation from Transform panel, It rotates perfect, center is in the middle of image, and when I apply mc.rotationY, rotation center is in left of the image, aren't 3D rotation from Transform panel and mc.rotationY from AS same? what's up?

View 2 Replies

Actionscript 3 :: Augmented Reality Flartoolkit Rotation - Trace The Rotation Of The Marker

Mar 23, 2011

I'm trying to do some augmented reality projects with flartoolkit . I can now put simple 3d objects on my marker and it works fine , but I wanna give my project some events that the user can interact with. I'm trying to trace the rotation of the marker. there's a container:DisplayObject3D which my application uses to add the 3d objects , I traced this :"trace(container.rotationZ)" but it's just returning 0 . I studied another AR application's source code and it was using the rotation of it's container object without problem .and I think I should mention that I'm using the exercise file of seb lee delisle papervision3d course from [URL]. anyone has any experience with flartoolkit? the main functions of my my code is as below:

[Code]...

View 1 Replies

ActionScript 3.0 :: 3D Rotation Of Nested Movieclips, Separate Of Parent Rotation?

Aug 11, 2010

Is it possible to have the child movieclip rotate separate of the  rotation  properties assigned to the parent? so ultimately giving the  child  element it's own axis?I've customized Lee Brimelows (gotoandlearn.com) 3D carousel to spin  on  the x axis to make it a vertical carousel. I've also rotated that by 45 degrees on the y axis to see all the items, and wrote a snippet of   code to hide the left portion of the carousel. The entire  carousel is contained within the 'container' movieclip, and  inside of  that are my carousel items (as seen below), with the larger  item being  the item in focus.

On rollover of the item in focus, I want to rotate it so it faces the   viewer (as seen below),basically removing the 45 degree rotation   applied to the container.The problem i'm running into is when you rotate the container (changing   the rotationX of the container), the axis basically rotates with it, so   when i rollover the next item 'in focus', the following happens..(in  the  example where it appears how it want it to, the carousel is at a   rotationX of 0, so it works fine)

View 2 Replies

ActionScript 1/2 :: Inconsistent Rotation - 270 Degrees Of Rotation Disappear?

Apr 21, 2009

Program A has a cannon that aims to line up with where-ever the mouse is pointing, in 360 degrees, and fires when the mouse is is clicked. Program B has an eye instead of a cannon that should in theory do similar functions when the capslock key is toggled, but instead only has a 90 degree range of motion from the Right of the eye toward the bottom (quadrant 4 only). Where did the ther 270 degrees of rotation disappear to?

[Code]...

View 4 Replies

ActionScript 2.0 :: Create A 3d Rotation Much Like The Widely Used Carousel Only The Rotation?

Aug 11, 2006

i.m trying to create a 3d rotation much like the widely used carousel only the rotation i desire consist of four upright(90 degrees) movieclips resting on a slanted, 30 degree plane which rotate onEnterFrame or following a tween on a oval like path - then pause for a given number of seconds at the four movieclips positions equal in distance on the plane

function around() {
this._x = Math.cos(this.angle) * radiusX + centerX;
this._y = Math.sin(this.angle) * radiusY + centerY;
var s = this._y /(centerY+radiusY);

[code]....

View 7 Replies

IDE :: Z - Rotation X And Rotation Y Missing In Motion Editor Panel

Feb 23, 2009

Why isn't there the Z, rotation X and rotation Y fields in my motion editor panel?

View 1 Replies

[CS3] Score Counter In A Shooter Game

Nov 24, 2008

I have a simple shooting game set up. 25 monsters appear on the screen, one after another, until no monsters are left. If you hit one before it disappears, the score increases. If you don't, the score stays the same.

In the actions frame, I placed an empty dynamic text box named score, and set it equal to 0 (declared in the main actions frame). But, seeing as though the monster actions are coded into the library item itself, do I have to declare score, and the score increase there instead?

View 4 Replies

F8 :: Glitchy Arcade Shooter Game

Aug 15, 2009

I've only played around with a dressup and dating sim - and coding using actionscript (and coding in general, only done a little bit of VB and Python before). I've been following a nice arcade side-scroller tutorial on this site which has three parts, if you want to view and go over them to help. It was designed for Flash 5 and I'm using Flash 8 Pro.[code]Anyway, as I was going through and coding/drawing the whole thing I came across a lot of problems and glitches (and a lot of times when the game coding would crash and I'd have to abort it and remake the entire coding again). I sort of stumbled around blindly, deleting and editing code to get things to work, and I'm up to the point where I'm almost finished with the thing. It's still glitchy though.I was wondering if any Flash coders could help me out?I'm going to be creating a Flash game for my programming class and I would prefer if it wasn't screwy (if I need to remake it with less cutesy graphics). xD;; If you could download the .Fla file and fix the coding problems I have.

Playable SWF game on my deviantart account.FLA downloadable file (@ Mediafire; no viruses, trojans, blahblah attached)The enemies tend to randomly explode before the missile has even hit them.The original enemy movie clip doesn't even want to explode.The score counter won't tick for each kill.The boundary box (?) of the player/enemy seems to be too big. You die before you should - in certain positions the enemy gets close and I guess the boundary boxes hit, which initiates the hitTest. It seems premature though, I'm wondering if I can reduce the boundary box, or have it so the enemy and player collide on the actual graphic, and not the movie clip box? I have no idea if this makes sense, I hope it does.There seems to be a bunch of other small glitches too.

View 6 Replies

Memory Leak In My Shooter Game?

Oct 20, 2011

I'm very new to flash,and have been digging through google and this site for information on how to piece together an AS2 shooter game.Its going well enough, but I'm having slowdown issues the longer the games runs, and I was hoping someone here could point me in the right direction.To paste an enemy movie clip on the screen, i'm using this:

Code:
var spawn =_root.attachMovie("monster1","monster1"+_root.getNextHighestDepth(),_root.getNextHighestDepth())[code]........

I need them stored in an array so that the player's shots can test weather or not they've hit any monster on the bullet's enter frame function, then call that monster's movie clip's take damage function. I'm using a for loop to do this:

Code:
for(var i in _root.player.foes){
if (this.hitTest(_root.player.foes[i])){
_root.player.foes[i].takedamage();}
}

I think the problem with the slowdown is that each time I place an enemy on the screen the array gets bigger and bigger. The slowdown only happens while the player is shooting, and I suspect the ever longer for loop with the hit testing is causing it.

I'm already removing the monster's movie clips as they get killed or exit the screen, I guess what I need is a way to reduce the size of the array at the same time, or at least tell the for loop not to do a hit test unless the monster is still alive.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved