ActionScript 3.0 :: Enemy Move To Player?

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


Similar Posts:


ActionScript 3.0 :: Enemy Animation Sequence - Rotate + Move, Then Stop Then Shoot Then Rotate Back And Move Off Screen

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

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

Flash :: Make Enemy Move Towards Mouse

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

ActionScript 3.0 :: Making An Enemy Follow The Player?

May 27, 2010

I've been working on a game for my AS3 class that involves enemies randomly spawning from all direction and following the player in an attempt to collide with him. I can get the enemies to spawn from one direction as well as move in a single direction but I can't get the spawning from all sides or the following the player around to work.

I've been at this for a couple of weeks now and followed several suggestions and tutorials (including one from here) with no success and this thing is due by tonight . Here's the code from my enemy class. All of the code of the game is done through AS files with no coding done within movie clips or on the timeline.

package
{
import flash.display.MovieClip;
import flash.display.Stage;
import flash.events.Event;

[code]....

View 14 Replies

ActionScript 3.0 :: Make Enemy Array That All Follow Player?

Feb 12, 2012

I am working on a first person shooter game, however i dont know how to make all the enemies that get created, to all move towards the character every few seconds then moving randomly for a few seconds, with the frequency increasing as the enemies move closer to the player. Getting that part is easy enough, the problem is i dont know how to make each enemy be able to do anything really independantly. Since my game works in a an external AS file, i cant access any of the class variables from within the movieclip of the enemies. Is there a way i can do this?

i already have code which rotates and moves the enemy towards a given point, as well as random movement, what i dont know how to is access the variables of the main class from the movieclips of the enemies, and vice versa ive found a way to do this, however it means i have to out the movement code within the enemies, as well as collision code, and that just laggs the hell out of the game when there is 5 or more enemies.

View 0 Replies

ActionScript 2.0 :: Movieclip - When It Hits The Enemy, It Goes To The Enemy's Second Frame?

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

ActionScript 2.0 :: Enemy Attack - Make The Enemy Pause When It Reaches The Character, Then Choose An Attack To Use?

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

ActionScript 2.0 :: If Hit The Enemy Ball (instance Name Is "enemy") It'll Disappear?

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

ActionScript 3.0 :: Scripting Platformer Game - When Hit "A", The Player Attacks And If Its Close, The Enemy Dies?

Nov 19, 2009

I have my player, I have my enemy, and I want to make it so that when I hit "A", the player attacks and if its close enough to the enemy, the enemy dies.I've found how to do this in AS2, but not AS3.

View 4 Replies

ActionScript 2.0 :: Have An Enemy Square That Chases The Player Square?

Jan 15, 2010

I have this game, and some levels have a moving square as the player, you move the square with your arrow keys.... I want to have an enemy square that chases the player square.... They only chased mario when you didn't look at them? Kinda like that...... but in this regards:

I only want the enemy square to chase the player square when the player square moves.... soo say the player square moves 5 pixels per movement (know how to do all that), I want the enemy square to move when the player square moves..... towards the player square at like 7 pixels per movement..... so eventually you won't be able to avoid the enemy square....

View 4 Replies

ActionScript 2.0 :: Movieclip To Move Against The Player When The Player Touches The Movieclip

Aug 25, 2010

I need a movieclip to move against the player when the player touches the movieclip i used:

[Code]...

When i put the code in the movieclip on stage level it works perfectly. but when i put it INSIDE the movieclip it only moves right. no matter which side the player is, when the player touches the mc it moves right no matter what.

View 1 Replies

ActionScript 2.0 :: Player Move To Box With Command

Dec 12, 2008

Currently on my page, I have:

- a circle with the instance name "player"
- a square with the instance name "box"
- an input textbox with the instance name "command"
- two rectangles forming a wall, each with the instance name "wall"

What I want to do is make the player move to the box when the words "go to box" are typed into the command textbox. I also need the player to walk along the shortest route, while also avoiding any obstacles (basically just the wall).

View 1 Replies

ActionScript 3.0 :: FLV Player Stop Playing When Move To A Different Frame?

Mar 19, 2010

I'm trying to create a small flash website for a Uni project (I'm a music student but they want me to be able to make websites, go figure?) and I am having trouble getting a video to stop playing when i goto another frame. Im using the FLV player from Window>Componants and i have named it PubPlayer. I've tried setting its source to Null, Using .stop() and even setting its volume to 0 but everytime i goto another frame it keeps playing.Im gettingTypeError: Error #1009: Cannot access a property or method of a null object reference.at AlbumsEps_fla::MainTimeline/GoAlbum()My code is as followsQuote:

stop();
PubPlayer.source = "Machines.f4v";
function GoHome(event:MouseEvent):void {

[code].....

View 4 Replies

ActionScript 3.0 :: Make Player Move Towards Mouse Not Working

Oct 1, 2011

[Code]....

Here is my main.as. I am using FlashDevelop to program this. why the Enemy object (which is displayed as a certain sprite) does not move towards the mouse?

View 1 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

IDE :: Get Sound For First Enemy And None For The Other Two?

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

ActionScript 2.0 :: How To Duplicate The Enemy

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

ActionScript 2.0 :: CS3 - Using 'A' Or 'S' The Foliage Or The Enemy Just Disappear

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

Way To Remove 'Enemy' When It Comes Into Contact With 'bullet'

Jan 18, 2010

Basically i just need a simple way to remove the "Enemy" when it comes into contact with "bullet".Ive been looking on the internet but its just really confusing me at the moment. And im not sure how easy its gonna be with the way i have set it up.

View 1 Replies

ActionScript 2.0 :: Can't Get Character To Die When He Touches The Enemy

Oct 25, 2009

I added attack to my character in the game and he attacks and the enemy dissapears, the problem if I can't get my character to die when he touches the enemy. I got it to work once but what happened was that even if I hit the enemy, as soon as I hit it I got to the game over screen and got stuck on a loop between the gameover screen and the moment I defeat the monster.

View 2 Replies

ActionScript 3.0 :: Instance Of A Random 'enemy'

Nov 5, 2009

I am building a whack-a-mole game in AS3. I have the basic structure down but am trying to figure out how to have one instance of a random 'enemy' appear in one slot at a time. So there would not be a duplicate 'enemy' anywhere else simultaneously as well as only one instance can occupy a slot at a given time.Anyone have any suggestion on what direction? Array? for loop?

View 1 Replies

ActionScript 2.0 :: The Enemy Keeps Looking Left While Being Defeated?

Aug 17, 2011

When I defeat an enemy when it is looking left. it looks left while being defeated but When I defeat an enemy when it is looking right. it still looks left while being defeated.How can I make an enemy look right instead of left while it is defeated?

View 1 Replies

Make An Enemy Bullet Go Towards The Main Character?

Oct 12, 2008

How would i make an enemy bullet go towards the main character?

View 7 Replies

ActionScript 3.0 :: Create An Enemy Spaceship That Has A Simple AI?

Jul 31, 2011

i.e. everytime the spaceship reaches a point a new one will be created randomly and the ship is flying to it (etc., etc.)Problem is that it doesn't really work because after the ship flies around for some time it suddenly stops to move. It's a matter of time. Sometimes the problem occurs after 5 seconds then again the spaceships flies around for 2 - 3 minutes and stops the movement immediately.Currently I have no clue where the problem is. I already checked the distance function but so far it seems to be okay

This is the code (just an excerpt):

Code:
private function update(timeDifference:Number = 0):void
{
var step:Number = (timeDifference / 1000) * timeBasedUpdateModifier;
for each (tempEnemy in enemyManager.enemies)

[code]....

View 7 Replies

ActionScript 3.0 :: Enemy Character To Fire A Bullet Every Second?

Jul 21, 2010

I am trying to program a game and I want the enemy character to fire a bullet every second, but instead he is firing an infinite amount of bullets right after the other. Here's the code with the timer:
 
if (k == 0){
var shootRight1 = new Timer(1000,1);
shootRight1.addEventListener(TimerEvent.TIMER_COMPLETE, enemy1shoot);
shootRight1.start();

[code]....

View 5 Replies

Code To Eliminate An Enemy Upon Mouse Click?

Dec 10, 2010

I need to figure out how to eliminate an enemy upon mouse click. I have a crosshair movie clip that im using because it follows the mouse. i need it to eliminate an enemy using the center of the crosshair when i click on them.

View 5 Replies

ActionScript 1/2 :: Get Enemy Offstage To Enter Stage

Aug 25, 2011

I'm trying to get the enemy offstage to enter the stage on the right and then once its x position equals 400 I want it to start moving back and forth (on x, there's no y movement).

View 7 Replies

ActionScript 2.0 :: Game Enemy Movement And Interaction?

Mar 17, 2008

I'm relatively new to creating games, however I've been a flash website developer (and designer) for over 7 years, and am used to OOP and AS2 Event-based programming. It was a bit tough to swallow the one-global function runs everything method but it all seems to be going fine now. The only problem I'm having right now is my math, and character movement and interaction.Also figuring out hitTests when the player punches, seeing as how you might have multiple hitTests be true, yet I want only those in the front row to receive damage.

Here's what I'm working on: http:[url].....

What I would like it to do, is for the enemies to swarm, but not walk "through" each other.Because the player only has his fists to defend himself (stipulation of the game unfortunately), they need to start far away, but then come up to the player's range and then mosy about in front of the player, jabbing him from time to time. The only thing, is that currently they look like paper dolls, because they move through each other, and the movement isn't very good either. This will allow the player to punch away their health until theirs none left, starting the new wave. my first big problem is the enemy movement and interaction with each other in a simulated 3d environment.The second would be how to get the player to deal damage to them, how can you tell that he punched the guy in the front row, etc.

View 3 Replies

ActionScript 3.0 :: Way Of Removing Enemy Character Permanently

Jul 9, 2011

I am trying to remove an enemy after I kill them and I just started working with code in .as files. The enemy has it's own logic in a .as file and when I use removeChild, the movieclip is removed, but the logic continues to attack the main character (invisible).Is there a better way of removing the enemy character permanently. It kind of scares me that the method I use could just be leaving invisible movieclips on the screen as well.I've tried everything that I have used in previous games: removeChild(EnemyArray[i]);And this, which causes other problems with my code but removes the logic: EnemyArray[i] = null;But these still cause the problem.

View 4 Replies







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