Flash :: Survivor Game (ennemies Going Through Walls, HitTest And Flashlight)?

Jun 5, 2011

I posted a bit earlier about some problems I had with a game I'm trying to do.[URL].. My first and main problem is that the ennemies are going through the walls. I can do a hiTest like with the player so that the collision is detected, but I don't know how to make the ennemy change direction. I thought it would be quite simpler if the ennemies could not move simultaneously on the x and y axis, but don't know how to do it. (then they would only need to make a 90 degrees turn)

Second problem is the hitTest for detecting collisions with the ennemies. It seems like I'm not able to do it. There is the part which I thought would be good at the end of the script in commentary. Third problem, which is the least important in my eyes is that we see the ennemies even if the "flashlight" is not aimed towards them.

[Code]...

View 1 Replies


Similar Posts:


ActionScript 2.0 :: Player Cannot Pass Through Walls Using A HitTest

Dec 22, 2011

I have set up a player (movie script) with basic movement, and some walls which the player cannot pass through (using a hitTest). But whenever the player moves into one of the walls in the X direction, the player skips through the wall and halfway up the stage.

View 9 Replies

ActionScript 2.0 :: Simple HitTest To Work For Rounded Walls

Mar 19, 2009

I've been trying to write a hittest that will work for rounded walls on my RPG. But I've been epic phailing.

Heres my code:
onClipEvent(load){speed=10;
}onClipEvent(enterFrame){if(Key.isDown(Key.UP)){this._y-=speed;this.gotoAndStop(5);
}if(Key.isDown(Key.DOWN)){this._y+=speed;
this.gotoAndStop(6);}
if(Key.isDo wn(Key.RIGHT)){this._x+=speed;this.gotoAndStop(7);
}if(Key.isDown(Key.LEFT)){this._x-=speed;this.gotoAndStop(8);}

View 2 Replies

ActionScript 2.0 :: Bouncing Off Walls - Stopping Movement When Hittest Occurs

Dec 14, 2003

If you take a look at this site Game then you will see that when you hit the walls or boundrys you "bounce" off them. I have accomplished stopping movement when hittest occurs but how shall I get the car to "bounce" off the walls. It would be great if you could supply the full code as I am not a great coder.

View 1 Replies

ActionScript 2.0 :: [FlashLight 2 + FSCommand2] Passing Values From Flash To JS?

Mar 28, 2007

Does fscommand2 work like fscommand with javascript to execute javascript commands locally? I have tried several methods and not been able to get fscommand2 to pass values back to localized javascript in a way similar to fscommand.

edit: I just realized I used FlashLight instead of Flash Lite.

View 2 Replies

Actionscript 3 :: Add Seconds To (game) Timer After Hittest?

Dec 24, 2011

I have a timer and a dynamic textfield wich displays the time. Everytime my movieclip hits an enemy I want the timer to add 4 sec. to the current count. I would like to know why this isn't working:

timer.currentCount + 4;

(does nothing)

timer.currentCount += 4;

(error: property is read-only)

View 2 Replies

ActionScript 3.0 :: 3D Projectile Game - HitTest Point

Mar 4, 2011

I have a 3d projectile game I'm working on. I want to check if the projectile moving down the z axis hits wall on two sides. The walls are set up like this:
leftWall = new wall();
leftWall.x = 10;
leftWall.y = 360;
leftWall.z = 230;
leftWall.rotationY = -95;
How to do collision detection in this 3d space?

View 2 Replies

ActionScript 2.0 :: Arcade Game HitTest - Only First Frame Of MovieClip

Nov 10, 2004

I'm building a a space shooter "Defender" type game, and I'm having a problem with the hit test. My laser hits the enemy (which a duplicate). Enemy movie clip goes to it's frame to which a short explosion animation. The hit test works fine, but since there is more than frame in the "enemy" movie clip, the hit test cycles through every frame of the "enemy" clip until it passes through it's boundaries. Is there a way to only have it hit test with only the first frame of a movie clip?

This is the script on my laser movie clip that performs the hit test:
if(this.hitTest(_root["enemy"+i])){
_root.score+=100;
_root["enemy"+i].gotoAndPlay(2);
this.removeMovieClip();

View 2 Replies

ActionScript 3.0 :: AS2 To AS3 Conversion / Simple Score & HitTest For Bug Splatter Game

Sep 26, 2011

Non-programmer here, struggling with having to now (finally) work in AS3.I've looked around, but can't find something similar (or as simple) as my old AS2 scoring - hitTest method was.Problem 1: my converted AS3 game does not hitTest or score.[code]I have a Dynamic text box on the stage named "scorecounter" which is now displaying "0" when the game plays. This is correct.When the gun (mouse) is clicked, we then tell the "hittest1" MC to play, which will detect hits. All Correct.[code]The hittest1 MC plays, and checks if the "cursor" MC was touching the "bug1", and tells it to animate (splat) All bug detections are listed in the hitTest frame - "bug1" through "bug30", ie. the code below x 30. This Fails - maybe because the hitTest MC lists all 30, and not all bugs are visibile at once, some are hidden until required later in the game?[code]Then on the last frame of the "bug1" MC (frame 10), it tells the score to add one. Also Fails - maybe because of errors above, nothing is being processed now.[code]

View 5 Replies

ActionScript 1/2 :: HitTest - Reset Game When Falling Box Touch Certain Object

Jun 30, 2009

I am new to flash and im trying to make a game. Im stuck on hitTest. I have many black boxes falling down and I want the game to reset when the black boxes touch my red circle. I used this code for my boxes:

[AS]
this.createEmptyMovieClip("canvas_mc",10);
myInterval = setInterval(addbox1,500);
function addbox1() {
[Code] .....
My red circle is controlled by the mouse. The code for that is:
[AS]onClipEvent (load) {
startDrag(this, true); }[/AS]

View 6 Replies

Professional :: Drag And Drop HitTest, Dressing A Model Game?

Mar 19, 2010

I need to create a game where you drag and drop clothing onto a body that snaps into place then when the body is fully clothed you click a button to see if the clothing you selected is correct. There will be 4 different areas of clothing with 3 options for each area, one for each area is correct. how to achieve this? In either actionScript 2 or 3.

View 3 Replies

ActionScript 2.0 :: [FMX] Game - Hittest With Movie Clips In The Centre Of The Stage And Distance

Apr 26, 2005

i am working on a game called "virus". you click somewhere on the screen and the virus goes to where you click. you have to dodge random moving white blood cells, and if you hit them you lose. everything is working. except for one thing. scoring.

i have made a movieclip with a dynamic textbox in (score), and in the movie clip there is a section where the number in the score textbox goes up really quickly, a section where is goes up medium, and a section where it goes up slowly. i want to make it so that when you get closer to the center of the movie, for the score to go up quicly, and slower as you get further out. i have tried hittest with movie clips in the centre of the stage, but it doesnt seem to work.

View 3 Replies

Actionscript 3 :: Programming Multiple Walls In Flash CS5?

Apr 8, 2012

I am trying to program a Flash Game that utilizes all four directions to move the character. (i.e. Pressing up moves the character north, down - south, etc.) The character in the game does not actually move, but the background moves to simulate movement. I need to figure out how to go about programming the walls, though. I have code that recognizes collision, but what is the best way to do it? This is my code:

stage.addEventListener(Event.ENTER_FRAME,handleCollision);
function handleCollision( e:Event ):void{
if(hero.hitTestObject(wall))
{

[Code].....

View 2 Replies

Flash :: Bouncing A Ball Off 4 Walls Of A Stage

Jan 5, 2010

When I bounce a ball off the walls of the stage using the following technique.[code]Not only is the ball jumpy and skippy. but after so often it begins to go either in a vertal motion y = 5; x = 0; or a horzontal motion x = 5, y = 0. And stays that way. Why is it that the first method works fine but the other method works terrible. Could it be because the Math.cos and Math.sin returns very large decimals.I really prefer to use the second method.

View 5 Replies

AS3 :: Flash - Stop Character From Moving Through Walls?

Oct 9, 2011

I want to stop the movieclips movement when it hits a wall (another movieclip). The example below works, but after the collision the movieclip 'blocks' all movement to the left...

For now the example with the leftArrow key;

variables to check the key, if it's hitting the walls and if it's moving or not:

var leftArrow:Boolean;
var speed:int = 10;
var hitting:Boolean;

[Code]....

View 2 Replies

Flash :: Preventing Box2d Player From Pressing Against Walls In Midair

Nov 20, 2011

I have setup a box2d world with a keyboard controlled player. The player can walk and jump. How do I prevent the player from "sticking" to walls while jumping and pressing the directional key towards an object?

View 3 Replies

Professional :: Flashlight Or Spotlight With Extra Effect

Jul 26, 2010

I'm trying to make a flashlight effect that automatically (not mouse controlled) goes over the text and image (all on the image) and then have the flashlight beam fade then open completely to the 900x400 image and stay visible...

View 7 Replies

Professional :: Flashlight Mask With Radial Blur?

Jan 10, 2011

I have a circle mask over a photo. I'm trying to get it so the edges fade out to black. Currently, it just is a solid white circle. It's a movie clip and has a radial blur and is motion tweened. The alpha channel on the radial blur is 100% on the first point and 0% on the last. Can a spotlight with radial blur/fade be done without adding code or actionscript?
 
I've attached a photo of what I have now along with what the movieclip I'm using.
 
I'm on CS5, but can only use AS2, if actionscript is necessary.

View 5 Replies

Actionscript 3 :: Control Iphone's / Android's Flashlight Through It?

Mar 21, 2012

Just that: is there any possibility to control the iPhone's flashlight using any class in ActionScript 3?

View 1 Replies

ActionScript 3.0 :: Using Masks To Create A Flashlight Effect?

Mar 8, 2009

I am using masks to create a flashlight effect. I have managed to mask the floor of the room but cant seem to mask the aliens as im unsure what code will mask the aliens.

here is the engine.as

Code:
private var thelight:light;
private var theplayer:player;
private var theroom:room;
//private var thebug:bug;

[code]....

View 4 Replies

Flash :: Professional :: Create A Simple Paint Visualizer - Display Walls

Apr 4, 2011

i'm trying to create a simple paint visualizer in flash. need to display two walls for example and a vertical color palette for the user to choose from. an example would be the following link [URL] (it's very advanced compared to what i need but i couldnt' find a simpler one on the web).

View 3 Replies

Flash :: Use FBML To Embed A Custom Video Player / Video On Facebook Walls?

Oct 28, 2010

I'm trying to get a video (flv) or an swf video player to work on Facebook walls, however no matter what I do - facebook posts the raw fbml and ignores the code.

<fb:swf
swfsrc='http://www.domain.com/flv_player/Main.swf'
imgsrc='http://www.domain.com/large1.jpg'

[Code]......

View 3 Replies

ActionScript 2.0 :: Bouncing Off Walls?

Dec 14, 2003

then you will see that when you hit the walls or boundrys you "bounce" off them. I have accomplished stopping movement when hittest occurs but how shall I get the car to "bounce" off the walls. It would be great if you could supply the full code as I am not a great coder.

View 1 Replies

DuplicateMovieClip To Randomly Generate Walls?

Sep 9, 2011

I might not even be approaching this the right way, but I'm trying to make a game where a ship flies through randomly generated tunnels. I'm very new at this, but I felt my question was a bit too advanced for the "Programming Beginners" section.So, what I came up with was two black vertical rectangles, ~50 px wide, ~300 px high and ~100 px apart vertically, as one movie clip. I want this clip to be duplicated infinitely, stacked to the right of eachother, and shifted by a random number between 0-10 pixels up or down.This is the code I used to create just one copy of the walls, hoping it would shift over to x=140:

Code:
for (var i=0; i<200; i++) {
duplicateMovieClip("walls", "walls_copy", 1 );

[code]....

View 6 Replies

ActionScript 3.0 :: Having A Dot Follow The Mouse But Not Go Into Walls?

Jul 5, 2009

I really didn't want to have to post this question on any forums because it would be hard to explain, but I have spent far too many hours trying to figure this out so I have no choice.his is what I want to do: I want to have a little ball follow the mouse but not go into any walls at all. Here is a swf of my current attempts at doing this:As you can see, if there is a Y obstruction but not an X one, the ball will still follow mouseX, and vice-versa. However, there are some glitchy limitations as to having the ball follow mouseX when there is a Y obstruction and it must go over some hills to get to mouseX.Also, the code currently only checks to see if the four points around the ball are sinking into the walls, but it would be nice if it used more complex sphere calculations, or maybe 8 points

View 9 Replies

ActionScript 3.0 :: Character Won't Bounce Off Walls?

Feb 10, 2010

I can only get my character to bounce off of walls above him, and to the left of him! when going right or down, he just goes right through.. I tried a lot of combinations. Little push in the right direction please?

Code:
private function loop(e:Event) : void {
//if (goingLeft) this.animGus.gotoAndPlay(51);

[code].....

View 3 Replies

ActionScript 3.0 :: Implement Snapping On The Walls?

Mar 16, 2010

I have a floor plan and I need to implement snapping on the walls. The walls are made with lineTo method.

View 1 Replies

ActionScript 3.0 :: Make The 'cannonball' Bounce Of The Walls?

Sep 10, 2011

I have this game, got various levels. The point of the game, is you have to shoot all the zombies in the level to proceed. But I need it so the 'cannonball' bounces of the walls so there is more of a chance to hit multiple zombies.
 
Incase you wanted to see my document class here it is below.
 
package {
import flash.display.*;
import flash.events.*;
import flash.text.TextField;

[Code].....

View 8 Replies

Actionscript 3 :: Character Only Stops At Walls In One Direction?

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

ActionScript 2.0 :: Surface Collision - The Block Go Through The Walls

Oct 12, 2004

I make this simple system to simulate a colision of a block in "walls" and bounce like a pong ball. To use drag the orange square and release to start the movement. But i have a problem, sometimes the colision not happen and the block go through the walls, i try less the time of setInterval that verify the colisions but not solve my problem. colision system -> [URL]

View 3 Replies







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