ActionScript 3.0 :: Platform Game 0 Can't Get Enemies To Face Hero

Nov 24, 2010

I'm making a platform game. The hero can move around, but the enemies are stationary. My problem is that I want the enemies to face the hero. The first enemy behaves correctly, but the subsequent enemies only behave correctly if I kill all the preceding enemies. I have added the hero and the enemies as Objects and put the enemies into an array called enemies. Both the hero and enemy objects have a direction property and an mc property that refers to their movie clips. This for loop gets called every frame.

for(var i:int = 0; i < enemies.length; i++)
{//face hero
if(hero.mc.x < enemies[i].mc.x) enemies[i].direction = -1;
else if(hero.mc.x > enemies[i].mc.x) enemies[i].direction = 1;
enemies[i].mc.scaleX = enemies[i].direction;}

View 4 Replies


Similar Posts:


ActionScript 3.0 :: Chasing Hero Game Character As A Square And The Enemies Are Circles At The Moment

Sep 11, 2009

i am making a game and i have my main character as a square and the enemies are circles at the moment. i have just made the circles home in on the main character, but my problem is when the enemies come inline with the x or y coordinates of my character they start vibrating/shaking. im not sure how to fix this. i have included my fla so you can easily see whats going wrong.

View 1 Replies

ActionScript 3.0 :: Flash Platform Game Random Enemies?

Feb 22, 2011

we just recently defended our graduation project which is a platform game like mario. one of the modifications suggested by our panelists is to make level 1 generate random places for enemies and coins after one of them said that mario was a stupid game because you already know where the enemies are, the powerups, etc. i said i'll give it a go and see what i can do. but recently i realized that i havent played any platform game that generates random places for the enemies, coins and other objects. it is only in rpg games like ragnarok that i have seen enemies spawning at random places.

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

ActionScript 3.0 :: Way To Show 'enemies' On Random Base On Platform Screen

May 17, 2010

I'm getting an error: [code]I'm also looking for a simple way to show my 'enemies' on random base on my platform screen. I already made an array with the x and y coordinates but I don't know how to make AS3 print them on a random way on the platform windows.

View 4 Replies

ActionScript 2.0 :: Make Charater Face Mouse Platform?

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

Android :: Cross Platform Game - IOS : Develop A Very Simple Game For Iphone/ipad?

Mar 7, 2012

I am going to develop a very simple game for android and for iphone/ipad I have the option to develop it in cocos2d or in adobe flash air (i am not a developer, but i have 2 developers who are offering me the service)I have a developer that states that cocos2d is better and other one that states that adobe flash air.I want it in cross platform.the cost offered by both developers is the same..i have heard that adobe air has the flaw that it is very slow, is this real? if you had the 2 options which will you use to develop your game and why?

View 1 Replies

ActionScript 3.0 :: Flash - Writing A Simple Game Rule For A Platform Game?

Feb 28, 2011

I'm creating a game at the moment for my university course and it involves the player character jumping on top of boxs twice to break them as opposed to just once.What would be the most efficient/simple way of writing this in Actionscript 3.

View 1 Replies

ActionScript 2.0 :: Making Guitar Hero Game

Feb 15, 2009

Dynamic text box on one frame that displays your currunt score or points youve got then ive got a Finnish button that ends the game and goes to the next frame with:another dynamic text box that i want to diasplay the total score aka:Display the socre from previous frame can i do that how? details:Score on first frame is called scoreBox Total score display text on second frame called: totalScore

View 4 Replies

ActionScript 3.0 :: Make A Multiplayer Hero-based RTS Game

Apr 12, 2011

I'm planning to make a multiplayer hero-based RTS game, similar to the gameplay of DotA/HoN/LoL. With about 10~ players max at once in a game. The latency and responsetime is key, trying to get as low ping as possible.And last but not least - I don't want to use any 3rd party solutions, such as smartfox server or any of the likes of it.So, with that said, what is the way to go if I'm going to build this properly? Java socket server? Python? Let me know what you think and please share resources since i haven't done anything similar before.

View 6 Replies

ActionScript 2.0 :: Platform Character - Set The "hero" Movieclip To The Frame Named "nothing" ?

Jul 22, 2010

I am making a platformer and i got two problems with the hero.The hero is controlled with the following script.

code:
onClipEvent (load) {
var ground:MovieClip = _root.ground;
var grav:Number = 0;
var gravity:Number = 2;[code].....

1. I can't seem to figure out how to set the "hero" movieclip to the frame named "nothing" when none of the keys that control the hero are pressed. (so the hero is doing nothing). When the hero stands still, it will still appear like he is walking or jumping (whatever has been done last)How do i tell Flash that something must happen when none of a certain group of keys are pressed?

2.When you jump, the "jump" frame of the hero is shown. But as soon as you move right or left while jumping, the "right" or "left" walk frames are shown. How do i tell flash to not show the "right" or "left" frames after pressing the jump key until the hero lands back on the ground? The instance of the ground is "ground".

View 4 Replies

ActionScript 2.0 :: Defense Game - Randomize Enemies?

Oct 6, 2007

I'm making a little tower defence game but i've run into a problem;I need a code to randomise my enemies (like in which direction they come from, and how many come)

View 1 Replies

ActionScript 2.0 :: Game Project - Placing Unique Instances Of Enemies On Screen

Mar 23, 2010

I've been working on a uni project. Basically, enemies are placed on the screen using a timer variable and using the attachMovie to put them on the screen. This is an example of the code I'm using:

Actionscript Code:
var enemies;var timer;
function onLoad(){
enemies = [];
timer = 0;}
function onEnterFrame(){timer++;
if (timer == 10) {
Timer = 0;
var enemy = _root.attachMovie("mc_1", "mc_1",
_root.getNextHighestDepth());
enemies.push(enemy);
}}

This works and places them on the screen, (and into the array) but by putting them into the array, I thought that each one would be a unique instance of the movieclip which doesn't always seem to be the case. If I shoot one of the enemies, sometimes another enemy will explode (or both of them) and other times I will knock into one enemy and another one will be the one who get's knocked.

For my collision code I'm using this:
Actionscript Code:
for(var i in _root.player.enemies){
if (some arguments..)
_root.player.enemies[i].health -= 10;
}}
The explosion code also uses a similar for loop. Should I look at another method to place unique instances of the enemies on the screen?

View 3 Replies

IDE :: Create A Platform Game?

Aug 29, 2007

I have this problem when i go to shot and then have shot the gun all movie clips accessed after shooting dont stop playing but repeat continuously[code]...

View 1 Replies

ActionScript 3.0 :: Add A Background In A Platform Game

Apr 8, 2012

I am doing a as3 platform game based in arrays, so inside the array I inserted a variable rh that inserts the bg in the stage but it doesn't show up in the stage. The code i have is:

Code:
else if (lvlArray[i] == 'ROCKYHILLS') {
var newRockyHills:backRocky = new backRocky;
newRockyHills.x = _root.stage.width/2;

[Code]....

View 5 Replies

ActionScript 2.0 :: Enemies On Minimap(radar) And Warping For Enemies

Feb 25, 2010

as from title above, minimap where enemies spawn and can be shown on the minimap and enemies warp like player_mc do. ps: i'm new to this forum. attached files below

View 0 Replies

ActionScript 2.0 :: Making Hearth On Platform Game?

Jul 9, 2010

I'm doing a kind of plataform map, and now I need to make health (3 hearts, like Mario). I tried to do it with hittest but the hearts goes like crazy. Guess I need to make something like invulnerable or I don't know. What I want to do is three hearts, and, if the human touches a spike he loses a hearth.

View 5 Replies

ActionScript 3.0 :: Error #1009 In My Platform Game?

Jul 22, 2010

In my basic platform game I have a "hero" that can walk and jump on the "ground." There is also a door to the next scene, which is the next level.The first scene works fine, but "TypeError: Error #1006: value is not a function. at Charles3_fla::MainTimeline/frame1()" pops up once in the output. It works however, and I'm not worried about it. The second I go throught the door though, Scene 2 opens, but then starts flashing as "TypeError: Error #1009: Cannot access a property or method of a null object reference. at Charles3_fla::MainTimeline/onenter()" pops up A LOT in the output. I don't know how to fix it, and would like help. P.S. I am using Adobe CS5 with actionscript 3
 
[Code]...

View 26 Replies

ActionScript 3 :: Platform Game - EFrame Continues To Run

Mar 13, 2012

I am making a platform game in flash. I have a goal class (the class which contains code for the goal sprite, where when you hit it, it continues to next part of game). Inside the goal constructor, 2 event listeners are added, they are as follows:
addEventListener(Event.ADDED, beginClass);
addEventListener(Event.ENTER_FRAME, eFrame);

The beginClass function is fine, and only runs once, but eFrame is what checks if the player has hit the goal, so it is constantly running. The problem is, once the player hits the goal, eFrame continues to run, while in a menu describing the next scene to the player. My eFrame function is below.

private function eFrame(event:Event):void{
if(hitTestObject(_root.mcMain)){
var lastScore:int = _root.mainScore;
_root.mainScore = lastScore;
while (_root.lvlHolder.numChildren > 0) {
[Code] .....

Frames 2, 3, 4, are frames with just text and a button that display a message to the player, and then the player hits continue. My problem is that eFrame is still trying to be run, but the class has not been instantiated, and the method is causing extreme amounts of lag once the player continues.

View 3 Replies

ActionScript 2.0 :: Create 2d Platform Shooting Game?

Feb 13, 2011

I am creating a 2d platform shooting game. Currently I have my main character walking around left and right and the stage background also moves left and right.

The problem I am having is that if I go to far left the charater just walks 'off stage' and into nothingness but the stage still follows. How can I make it so if the character hits a certain point he just 'stops' and cant go left no more but can go right no problem. I have tried using hitTest with another movieclip but couldnt get it working.[code]...

View 1 Replies

ActionScript 3.0 :: Platform Game Error #1009?

Feb 13, 2010

I am creating a platform game and am getting the following error:#1009: Cannot access a property or method of a null object referenceThis error happens when I remove all children from the stage on line 154 of the Robbery.as class. Im guessing that maybe it is still listening for event in the other classes but I'm unsure how to remove these from within the document class.

View 1 Replies

ActionScript 3.0 :: Platform Game Fall To Ground Function?

Feb 16, 2010

I have gotten to a point with my platform game where I am completely stuck. I have the player movement working fine but the only thing is, it doesn't fall off the blocks.

I have a Floor class which references the Character class and tells it to stop jumping when it is on a block through a hitTestObject. I have tried to research how other games have added functions but can't seem to find one which will work in mine.

View 1 Replies

ActionScript 2.0 :: Platform Game - Turning Off Variable In MovieClip

Feb 14, 2011

I am working on a platform game and I am having a problem with the script. I have a mc with my character in it named "mcMain", I placed all the script into it. Inside the movie clip I have 20 frames, the first 5 are standing, walking, jumping, crouching, and crawling. Frames 6-20 are an attacking animation. The problem is in frame 20 I want him to go back to frame one and turn off a variable (called "ram") in the movie clip.

The problem is with the variable ram (which is established in the onClipEvent(load) section of the script). I have it turn on when the character attacks and I want it to turn off after the animation is complete. The problem is it is not turning off. I have it targeted but it does nothing. I have tired both a direct and relevant target along with a _parent.ram = false;

Here is the script on the movie clip.
Actionscript Code:
//Establish VariablesonClipEvent (load) {
var speed:Number = 0;var walk:Number = 6;
var run:Number = 12;var grav:Number = 0;
var falling:Number = 0;
var jumped:Boolean = false;var jumpHeight:Number = 23;
[Code] .....

And here is the script inside the movie clip on frame 20
Actionscript Code:
_root.mcMain.ram = false;gotoAndStop(1);

View 3 Replies

ActionScript 3.0 :: Platform Game - Disable Jump When Falling?

Nov 17, 2008

I'm making a platform game in AS3. I've sorted the left,right and jumping movement of my character - apart from one jumpingproblem:When the up arrow key is down it sets the jump var to true.ENTER_FRAME function detects when jump = true and it decreases thecharacters y position by the var velocity while at the same timedecreasing velocity by 1.5px. So my character jumps up to a certainheight then comes down - There is a hit test to stop heump/fall. BUT when the character falls off a platform he can still jumpwhen the up arrow is pressed. I've been racking my brains but I canstop the character from jumping if its falling.

View 2 Replies

Java :: Platform For Web-based Multi-player Game?

Sep 28, 2010

I'm developing a web-based fantasy football game. Most of the game is a straight-forward web application built on top of Linux/Apache/Php/MySQL.

I'm trying to figure out how to implement the draft application. The draft date and time will be scheduled in advance by each league's owner. Up to 32 users may be logged on for a given league's draft, and there is no limit to how many drafts may be happening concurrently. The users will take turns selecting players, and each user's turn will have a time limit. I'd like for all the users to be able to see whose turn it is, how much time that user has left to select a player, who they select, and which players are still available. If there are users in the league who are not logged in during the draft I'd like to be able to detect that and automatically assign players to them rather than waiting for the time to run out on their turn. Ideally I'd also like to have a chat window so the users could chat with one another during the draft.

My background is in desktop application development, so if necessary I could write server code in C#/.NET or Java. As far as I can see these are the options: PHP/AJAX - It seems like it would be possible to have all the state for the draft in the database and have the operations for the draft run in PHP triggered by requests from the clients? I guess in this case the draft doesn't start until at least one user logs in, and it seems like it would be a lot of polling requests to the server if I want everyone notified quickly when a user makes a selection.

[Code]...

View 2 Replies

ActionScript 2.0 :: Make A Platform Game Im A Newb In Flash?

Jan 25, 2003

make a platform game im a newb in flash

View 4 Replies

ActionScript 3.0 :: Create A Side Scroller Platform Game?

May 24, 2008

I've been searching online now to find a tutorial on how to create a game like thisI don't have a lot of experience with action script I've only used flash for animations. I found 1 tutorial that was useful but it only gave code and text with out a .fla or images. If you could tell me what I need to do to accomplish this and where to put code ect

View 13 Replies

ActionScript 3.0 :: Item Not Affected By Gravity In Platform Game

Jan 21, 2010

I'm just starting out in actionscript 3.0, and I'm trying to create a basic platform game. Since I don't really have time to code it from A to Z, I'm using an 'engine' I found here. I've made a few modifications (mostly deleting stuff I don't need, such as the enemies and the coins). Now I'd like to create a crate that the player character can pick-up, throw, put down and jump on. I've created a new class (Cage.as) for it, based on the player class. When I run the game, the crate is displayed, but it just floats there. I can't figure how to make it interact with gravity (i.e. fall to the ground).

View 3 Replies

IDE :: Make A Platform Game - Create Multiple Levels?

Mar 27, 2010

trying to make a platform game using a tutorial on emanueleferonato.com, but I dont know how to create multiple levels. How could I create a door that when touched by the hero is sent to the next level? The tutorial is here:

http:[url]......

View 1 Replies

Professional :: Where To Start Simple Platform Game With Jumping Object

May 28, 2010

What resources should I look at to learn how to create a very simple platform game, with a character who can simply jump on platforms and avoid enemies to reach the end of the level? I have made games like this with other languages but never flash.

View 2 Replies







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