ActionScript 3.0 :: Enemy UI - Move To X And Y (Animation)
Jan 4, 2010
I've been trying to make my somewhat first game, and got stuck. Trying to make the "Enemy UI".
You don't need any background info.
Enemy is at 100X and 200Y.
Make him move to 350X and 50Y. ( in a somewhat animation )
So I was thinking, check if Current X is smaller or bigger than 350, then every frame (or by Time Animation ), do x++ or x-- Accordingly.
Same for the Y.
Is there a better way to it? Something that will make the animation smoother? A way that's better, can be "upgraded" in the future?
View 4 Replies
Similar Posts:
Aug 10, 2009
I am having some dificulty making a path for this enemy i'm trying to create... cause i want him to rotate + move, then stop, then shoot, then rotate back and move off screen... Its easier if you see it.. you can download the swf file in the zipped archive to demonstrate what i mean. I did it there with tweens. Anyway.. i tried and make it but i'm a little stuck on the stopping part... you can also see what i did in the fla file attatched...
View 1 Replies
Mar 7, 2009
create a basic enemy AI that will make it possible for the enemy to move towards the player. Also something to make it so that the enemy will rotate when it moves.Good example of what im explaining is here but its Actionscript 2 instead [URL]
View 2 Replies
Oct 1, 2011
package {
import enemies.Enemy;
import flash.display.Sprite;
import flash.events.*;
public class Main extends Sprite {
[Code]...
The enemy class has a bitmapped embeded into it. I am using FlashDevelop to program. When I do something like enemy.x+=1 it works, but when I try using my tween it script the enemy stands still no matter what the position of the mouse.
View 3 Replies
Oct 31, 2009
how can i find out from a for loop that which object from the array has been hit; For eg - i have 2 enemies in an array and i run a for loop
[Code]..
View 2 Replies
Sep 11, 2011
I am creating a game and I want that when the enemies started to attack me, I want it to plays random animation(the enemy is movieClip who contains other MovieClips )
View 6 Replies
Jun 7, 2009
Recently I've been developing in a certain way that i'm not sure is wise, so I thought I would ask the guru's here for guidance. Let's say I'm developing a game with an "Enemy" class. Recently I've been making references to all the subclips in the Enemy animation and holding them in my class as variables, so for an Enemy called "Troll" i might have variables in the class saved as:
private var _walkAnimation:MovieClip;
private var _runAnimation:MovieClip;
private var _attackAnimation:MovieClip;
and then reference these whenever I need to flip between the animation states for that Enemy instead of using getChildAt() or getChildByName() to find the relevant subclip every time I wanted to reference it. I was once told saving CPU was more important than conserving memory in cases such as this, but I wanted to make sure this was true. Your thoughts?
(I call a dispose() or destroy() function when I remove enemies so the references can be Garbage Collected)
View 2 Replies
May 31, 2004
i have one movieclip and i have another movieclip>enemy...okay so when the first movieclip goes over the enemy, nothing happens until i roll out! all i want to do is the movieclip, when it hits the enemy, it goes to the enemy's second frame and that's it ! there are no syntax error in this script, just something i want to do that apparently doesn't work right.here is my code:
Code:
onClipEvent (load) {
speed = 2;[code]...
View 14 Replies
Mar 18, 2006
I am currently making a game, similar to StreetFighter,where enemies will come on from the side and you fight them. Now i have the character movement and attacks fully scripted, and have made an enemy, and i make it move towards the character using:
onClipEvent(load){
movethy = 7;
scale = _xscale;[code].....
Now this works quite well and the enemy stops when it hits the character, but the problem is, it wont complete a full attack, instead it plays a few frames of the attack MC. Now i have every attack in a different MC (Frames 2-5) inside the Enemy MC. How can i make the enemy pause when it reaches the character, then choose an attack to use? From there i'll be on my way and can script the hittest and so forth.
View 2 Replies
Mar 28, 2008
I have a ball (instance name is "ball") and if I hit the enemy ball (instance name is "enemy") it'll dissappear, and add 100 points. At the same time, I want them to multiply and get faster.The enemy has a follower code:
onClipEvent (enterFrame) {
if (_root.ball._x>_x) {
_x += 2;[code]....
And the ball has a code that is secret because if I give it to you it'll spoil the game idea.The dynamic text box has an instance of "points".I have my mute sound control done and the ball you control done.
View 2 Replies
Aug 29, 2009
I'm using CS4 (actually the original fla was written in 2004MX) and have a completed frame-by-frame animation which is now in the wrong place on the Stage.
The final animation now only takes up a small part of the original stage, so I want to move the whole thing ( a complicated mixture of frame-by-frame and tweens , 6 layers and 700 frames) up to the top-left corner and then reduce the document to fit.
View 5 Replies
Jun 30, 2010
I have spent 2 hours on this simple state to state transition with simply resize and move animation. I can get the element to move and fade...but there is no resize animation at all. The panel element stay the same width whole time. If I copy the code to a brand new test mxml file, it works, but not in my main application file.
[Code]...
View 1 Replies
Feb 10, 2011
I need to create an animation and provide some results of the move function at the END of the animation. However, i am not able to control the output till the move function is completed
I tried the isPlaying- that doesn't seem to detect that the animation is completed... so continues to output resukts before the animation is complete
sample code I tried
private function mvbut():void{
var mv:Move= new Move;
mv.xFrom=Math.random()*300;
[Code]....
View 1 Replies
Nov 10, 2003
How can i move an animation backward and forward with the movement of the mouse on the x axis? all of the mouse trailers etc move an object which is linked to the mouse. however i don't want my movie clip to move around the screen. I have an animation of a wave form which I've animated to look as if the wave is increasing and decreasing, ie its amplification. I'd like to move this animation with a mouse movement. ie move your mouse to the left and the wave form increases. move your mouse to the right and the wave form decreases.
I have made an attempt. but it is very clunky and the link with the mouse isn't exact. the animation of wave form moves only if the mouse moves to one side or the other. it's not instant, like the infinite menu.
here is my clunky code:
if (_root._xmouse>=300) {
_level0.animation.nextFrame();
} else {
_level0.animation.prevFrame();
}
View 10 Replies
Oct 29, 2011
What I have is a ninja star that spins around and moves based on the accelerometer of your phone. I created a balloon popping animation and have it all working well. The problem is that as of right now I can either have it be static and animate once the ninja star hits it, or I can have it randomly move and then play the animation which is not what I want. I want it like this: When the ninja star hits the balloon, the animation of it popping plays. And then once the animation is complete, then I want it to randomly move to a new position on the stage. (so the user can hit it again, and so forth...)
Here is my code so you can all take a look.
import flash.sensors.Accelerometer;
import flash.events.AccelerometerEvent;
import flash.events.Event;
var my_acc:Accelerometer = new Accelerometer();
my_acc.setRequestedUpdateInterval(50);
[Code] .....
View 5 Replies
Jul 7, 2010
I have 2 overlapping movieclips on the stage. Both are instances of the same movieclip, but with different names. One bigger then the other, due to a magnifying effect. (I have tried to out-rule that code by the way, so its not that). The intention is to make both movieclips play when the mouse is over the stage and then stop as the mouse leaves the area. Seems simple and I have done that alot of times with other animations.
[Code]...
View 1 Replies
Aug 3, 2009
I have a small tween animation, which i copied to AS3 code using the automatic feature in Flash CS3. the animation basically shifts a certain movie clip horizontally (only X axis) a few pixels. the line of cose which is responsible for this is: <Keyframe index="4" x="500"/> i wanted to make this animation slightly smarter. i want to have that code take the movie clip to a specific X coordinate no matter where it is on stage at the moment the animation is triggered.
for that i wrote the following code: var n:Number = work_btn.x - (-172.4); whereas work_btn is the instance name of the movie clip controlled by the code and -172.4 is the specific X coordinate i want the movie clip to go to when the animation is triggered. i figured that way, n stores the pixel distance between the current location of my movie clip and its final destination. now is there any way i can tell the code to move the movie clip by n amount of pixels?
[Code]....
View 1 Replies
Mar 30, 2011
I have a Flash video which sits in a small box on the side of my website and plays video.When the user clicks on a 'View larger' button I need it to display in a lightbox - but continue playing from the same place.A simple piece of jquery like this works fine to move the video to another DIV (such as a jquery UI popup window).
$('.holder', dialog).append($("#DemoVideo")[0]);
However in Chrome + FF it restarts the video from the beginning - basically it reinitializes the <object>.My solutions are either : Position it absolutely with CSS in the first place and move it to the popup with CSS and some nasty JS event resize handlers. Remember the position and just instantiate a new video player and make the user live with the delay of rebuffering
View 2 Replies
Jul 14, 2011
how to make one object move to a specific point with animation in Actionscript ( not MXML code ) ? ( Flex 4.5 )
View 4 Replies
Aug 5, 2005
What I have is actionscript which moves a movieclip from one point of the stage to another, using two buttons to trigger it - fwd_btn and rwd_btn. I also use a setInterval function, so that when you press one of the buttons, it pauses a second before moving. Unfortunately, if you press the fwd and rwd buttons in succession rapidly, the animation gets caught in a never-ending loop. Also, note that every time the user clicks a button, if the movieclip is right in the middle of animating across the stage, I wish it to stop and pause, not complete the animation and then pause.
View 3 Replies
Aug 23, 2009
I just got Flash CS4 yesterday. This is the first time I have ever used Flash. I watched some tutorials and now I'm trying to do something on my own. I want some text against a white background to start out white in the lower-left corner. During the animation I want the text to move to the upper-right corner and turn black gradually as it goes. What I did was this:
created an actionscript 3 file
Made some white text at the bottom-left
Right clicked at the 90th frame on the timeline and clickedInsert KeyFrame
Right clicked between the 1st and 90th frames and clicked Create Classic Tween.
At the 90th frame I moved the text to the upper right. Then I clicked on proprties and set the text effect to brightness and set the brightness to 0 so the text would be black.When I hit enter to go through the timeline it shows me exactly what I expected: The text moves from lower left to upper right and gets darker as it goes.
When I hit Ctrl+Enter to preview it as a published movie the text stays white the whole time until it gets to the upper right. There it turms black. So all I see is nothing for a few seconds and then a flash of the black text.Also, if I click at each frame in the timeline I can see the text is in a different place and getting brighter gradually.I'd like it to play once rather than looping. Under the effects I clicked on a thing that says play once but it still loops. Where do you control this?
View 3 Replies
Jan 9, 2011
I want to use tween animation to move 6 or more images onto a stack in the middle of the stage. (I can do this). When all the images are in the stack, I want the images in the stack to disperse to various parts of the stage.
View 1 Replies
Sep 1, 2011
I want to make a flash animation that makes an object move across the screen to a certain point, depending on what is typed into a text box, and i want many of these moving objects at once, so that you can type in a number and then the object moves to that point. Can this be done?I have used flash but have done verry little with the actions of flash, so please walk me through any actions that will need doing
View 1 Replies
Jun 18, 2010
I am trying to do the move vertically animation on a button nested in the vertical layout. I am not sure if the Hgroup restricts the button moving vertically.
<s:states>
<s:State name="default"/>
<s:State name="addRecommend"/>
<s:State name="seeOther"/>
[code]....
View 1 Replies
Jun 2, 2010
I'm rather new to AS3 but I have to make a gallery like on this website. [URL]. I have only 4 pictures and 4 buttons but I have also two arrows on each side. I would like to make it in a main timeline. Like an easy animation and than with as3 send user to one of those four pictures when he is clicking on buttons.
View 1 Replies
Dec 3, 2009
Im doing a little game with three kinds of enemies. When each enemy blows up I'm trying to put in a different sound. Right now I get sound for my first enemy and none for the other two. The code is the same for all(?). Here's the code:
[Code]...
i have NO idea but will continue 2 scrabble around blindly 'till someone throws me a bone
View 2 Replies
Aug 11, 2009
so I have some buttons that, as of right now, simply trigger the scene to move on while at the same time killing some particle effect animations I have spawning when the animation is idle. What I now need to do is make these events move on to a specific scene AFTER the rest of the scene's animation has played out (about 400 more frames) I'm figuring that the gotoAndPlay command has to be tied to some sort of timer variable that I would have to figure out based on my fps. Or maybe there is a way to set up a timer directly tied to a certain amount of frames allowed to go by. I'm pretty noob at actionscript, so keep that in mind. Here is the script at the point where the animation pauses to await user input on the buttons:
[Code]....
View 4 Replies
May 2, 2009
I'm trying to make a small game and I've got most of it done. I just need to learn how to duplicate the enemy, so when one dies another one or two can take his place. The enemies instance name is "ninja" (no quotes).
View 1 Replies
May 26, 2010
I'm still struggling with going from a loaded swf to the next frame in my timeline, where a new swf file will be loaded.Ths is my current code which is trying to move onto the next frame in my timeline is located at the end Frame of a 10 second animation:
[Code]...
View 3 Replies
Jan 16, 2010
Excuse me, I'm making a flash game. But, it's kinda odd. I'm using Adobe Flash CS3 and Windows7 64-Bit as OS. Here's the link (around 1MB (FLA and SWF)) : [URL] The problem is : When I shoot using 'A' or 'S', the foliage or the enemy just disappear. Sometimes it's fine, sometimes it's wrong. Is my AS wrong ? Or is it because I'm using Windows 7 64-Bit ? It's for my final assignment. I've tried this past 2 days and I don't know what to do anymore >.< The deadline is this month.
View 1 Replies