ActionScript 1/2 :: Get To A Certain Distance Of The Enemy It Should Trace (shoot) - Won't Work
Aug 5, 2011what i whant is when any of the units get to a certain distance of the enemy it should trace(shoot).
[CODE]...
what i whant is when any of the units get to a certain distance of the enemy it should trace(shoot).
[CODE]...
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 Repliesi 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]...
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.
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.
I am working on the project where everything is based on the distance from the center of the stage. First I made this fla where flash outputs the x and y distance from the center. First problem is that I want to output distance only in positive numbers.
View 1 RepliesI am posting my code that attaches the movieclips on stage
[Code]...
i was hoping that when the newMc expands, all other mc would keep the same distance between each other as at initialisation. I not able to figure how to do it. maybe even an earlier post or llink where similar query was explained.
In AS3 I am trying to get the distance between 2 3D objects by using distance method.
if(Vector3D.distance(model.position,model2.position) < 100)
{
// do something
[Code]....
>>You can use it directly as a method of the Vector3D class to get the Euclidean distance between two three-dimensional points.
Which point does this method pick? Is it the closest point to the other object ?
I am just thinking of how much time this would take in testing objects with large poly count.
For some reason trace does not work on when I put trace into my ActionScript files. I use the Flex SDK to build Adobe Air applications. I am currently on Flex SDK 4.5.1 and Adobe Air 2.7.I have checked that idl is not running, can't find a trace of it ( pun not intended ).I have also added mm.cgf to ~/Library/Application Support/Macromedia, that hasn't worked either.
Update: create basic HelloWorld.mxml
<?xml version="1.0" encoding="UTF-8"?>
<s:WindowedApplication
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
[code]...
But it still doesn't work. Provided the code, that by some weird chance it could be the app.
hive just started actionscripting instead of tweening so be gentle. i use mx 2004 but i cant get the trace function to work.., here is the code form a kirupa tutorial...
_global.myvar=5;
trace (_global.myvar);
why does this not work?i thought it shud display 5.
I've got something simple in my main time line. I know I must be missing some kind of loop function, as the hold down doesn't work unless I keep clicking. And my trace doesn't work unless it starts on the 'enemy'. I'm just not sure what
Code:
import flash.events.MouseEvent;
_left.addEventListener(MouseEvent.MOUSE_DOWN, moveLeft);
function moveLeft(e:MouseEvent){
_hero.x--;
[Code] .....
When I put a trace("test"); at the entry point of my flashdevelop project and run it. The application runs fine but I do not see the trace in the output. Below is my code
package
{
import flash.display.Sprite;[CODE]...
I am using FlexUnit4 with FlashBuilder4. A lot of the classes that I'm unit testing make use of the Flash Logger.In the main app, we use TraceTarget so that the logging shows up in the trace window, which greatly aids in debugging:[code]I'd like to do the same thing for the unit test runner that FlashBuilder generates (FlexUnitApplication.mxml), but I'm not sure how to go about it. I could, of course, add TraceTarget to FlexUnit Application. mxml, but as the warning at the top of the file says,My question is: how do I get logging-to-trace to work with FlashBuilder and FlexUnit?
View 1 RepliesI cant seem to work out to trace the content of a data grid i have populated with info;Once I can work out how to trace it or each row i would push it into a new array for exporting.
so for example: i have a datagrid instanceNamed(info) //populated from a CVS file; text file//
containing 150 rows and 15 columns. I would simply like to trace this in the output window .From then i will work out how to write to disk. i have been searching around but cant seem to find a solution to this problem.
I have the following code in the main timeline:
[Code]...
how to make the final trace statement work?
I got this weird problem, when i run this code:
Code:
package {
import flash.display.MovieClip;
[Code]....
In Flash Cs3 it acts exactly as i want, the ENTER_FRAME runs and the addObject places numerous sprites on the stage. In the window output i'll see the trace. But when i run this code in Eclipse which is set up to use the Flash Player as output i get the first trace from EDHV_ImageSlider but the traces inside addObject won't show up, the sprites however are generated perfect.
The difference between the eclipse setup and the cs3 setup is the fact that the cs3 setup has a *.fla which calls the *.as package.
this is in my bullet movie clip on the timeline.[code]It all works but when i turn around it still shoots the same way im sure its something simple but i just cant work it out.
View 7 RepliesI am having issues with a global array. I have an actionscript file called MyGlobal.as at the same level as my main FLA:
[Code]....
I am able to trace that first element while trace is called within the function... but if I try to trace that first element outside of the function it is "undefined". Do I need to return the array at the end of the function? I tried that but I cant seem to get it working correctly.
I've been playing with prototype a bit and I've noticed that either it isn't as static as it should be or that some functions are protected from altering, or that in some cases the prototype actually extends a function. For example, I was trying to modifiy the global trace function to output the current time of a trace action, something like this :
Code:trace("lulu"); // output 12:48:17.286 lulu I DID achieve something close to it, but it seems that I haven't actually modified the global trace function, but rather it's "_root" counterpart,
[Code]...
ive got a loaded xml list for an mp3 player. from playing track1, when i select track 2, it traces "track1" but then after a second click it traces "track2" and stays on that. the actually music for track2 does load on the first click though, but not the trace. anyone know why on the first click it would still trace the previous track? here is the code for that function...
[Code]...
I have a TargetCirlce_mc which moves on "y" axis from top to bottom. And I have an arrow_mc which is on x:100 & y:200. How can I shoot an arrow exactly on the registration point of the TargetCircle_mc (automatically) while it is exactly opposite to the arrow_mc?
View 1 RepliesMy goal is to shoot a bullet everytime I click on ship. What happens, in fact, is that If I click on it once, the bullet is shot, but if I click on it twice before the first bullet is off the screen, the first bullet literally stops(it does not disappear, only stops) and the second bullet is shot.
public var ship:Ship = new Ship();
public var bullet:Bullet = new Bullet();
stage.addChild(ship);[code]...
I'm doing a simple game where you move the character using the arrow keys and shoot using the Mouse. The character rotates based on the Mouse angle. I have two problems: when I move the character, he moves once, then stops then moves again as normal. My other problem is that when I click over a MovieClip, the bullet goes to the wrong angle.My moving function:
Code:
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyHandler);
function keyHandler(event:KeyboardEvent):void {
[code]....
How do you make a MC like shoot a gun or something when you press the spacebar?
View 1 RepliesI'm working on a new project, its a side scrolling game where an airplane (user) has to shoot down a bunch of other enemy planes. how to create an AS to shoot lasers from the nose of the plane
View 6 RepliesHow would you go about making a movie clip shoot a bullet from it, but have the movieclip able to move around, like a sidescroller game...
View 2 RepliesI found a basic example of how to create something that'll shoot an object and create an arc based on an angle. I added a power Bar to it, but I noticed something bad about it.
The way it works the higher the speed is the further it goes and the faster it moves across the screen. This doesn't give me enough control. Because essentially I want fast moving projectiles but I want to also be able to shoot both near and far.
With this current system that's an impossibility.. Can anyone shed some light on how I can do this better? Here's the current way it's being done (important parts):
Code:
bullet = new Bullet;
this.stage.addChild(bullet);
bullet.speed = 1 + powerBar.scaleX * 20;
[Code].....
When I run the file and try to shoot the zombies, none of them are clickable. I really can't tell what I have done wrong here. Here is my code:
stage.addEventListener(Event.ENTER_FRAME, moveBullseye);
function moveBullseye(event:Event) {
bullseye_mc.x=mouseX;[code].....
THIS THREAD IS SOLVED.. Answer lies upon a website tutorial. Final Page on this Thread.So far so good, i've gotten most my as2 to as3.. And coming out good Buttons are working, The only last part im working on is upon shooting, it'll bring in the calls to Fire the missle.. (tracein the button works great).
[Code]...
This is what im trying.. But it says undefined use for addchild.. so im taking im missing somthing..
(the missile is a animation graphic i created).I have made a Missile.as to control what the missle does when its addchild is placed on stage. Problem is, (addchild isnt doing it) and im not sure if its going to shoot out the nose of the hero..
i've posted many times and got loads of responses but i dont understand how to make a bullet hole appear when you shoot an object. MSN me a [URL] to have a chat about doin the actionscript.
View 1 Replies