ActionScript 3.0 :: Triangle Maths - Collecting Stars That Appear At Random Moments?

Jan 13, 2012

i want to finish it in the end! i have this code which generated 20 stars and an ai player collects all of them (going for the one which is closest to it). This code was courtesy of -lauri... the code was

ActionScript Code:
import flash.events.Event;
import flash.display.MovieClip;[code].........

what i have currently is a player who moves around with the arrow keys collecting stars which appear at random moments... i wanted to make it so that the ai can also collect these stars and i am pretty sure that the code for that would be linked to what.

View 6 Replies


Similar Posts:


ActionScript 3.0 :: Triangle Maths - What Equation Would Take The AI Player On The Most Direct Route To The Star?

Jan 4, 2012

In the scene there is a star and an AI player.what equation would take the AI player on the most direct route to the star...i.e guide it into the path of the star...just to make things clear, the star is static and the ai plaer is controlled by the computer. i think you have to make two variables distx and disty and use some sort of trigonometry on them but i'm not entirely sure on how to go along doing this.

View 9 Replies

ActionScript 3.0 :: Calling Phd Maths Gods Best Random Formula?

Apr 13, 2010

I have an app that was actually written for me. It's a multiple choice quiz basically where a question comes up and there are 4 answers. HOWEVER the answer always seems to be 80% on the same answer ie: BUTTON ONE out of the four. BILLIANT random function I don't think.Would this be a better answer formula to use?
 
function randomBetween(a:Number, b:Number):Number {   return (a + Math.floor(Math.random()*(b-a+1)));}

View 8 Replies

ActionScript 2.0 :: Random Movieclip - Tracing All Stars With _x Values

Apr 27, 2009

So. I have this relatively simple code

[Code]...

when I run it, there's this wierd random star just in the middle of the screen. I tried tracing all stars with _x values of 0, 200, undefined; _xscale values of 0, 100, undefined. There was nothing. I don't know why it's there. I don't even know if it has code in it. =/ Does anyone know what it is? Btw, I know it looks like crap ... sorta more like a glue gun than stars ... I have a better looking version, I just used this to try to disect the problem.

View 7 Replies

ActionScript 2.0 :: Stop On Frame Label Depending On Random Maths Answer?

Mar 9, 2012

im working on a maths style jigsaw, and ive come across a problem of sorts, ive set random1_txt.text to 1 and random1_txt.text to 2 for testing, basically i want to randomise two textfields between 1 and 10, and also randomise the sign between either a - or a +

the answer can be computed by flash, now what i need it to do is stop on the frame number of the answer in answer_mc, these frames contain graphics of all numbers 1-20 in alpha format, this is so that the answer is in place, now the user can drag and drop movieclips into the answer box, and receive a correct or incorrect response

im at a loss on how to do this, i havent gotten around to randomising the sign as of yet i need to do more research but the general idea is as above

Code:
var startX:Number; //start of draggable piece
var startY:Number;
random1_txt.text = "1"

[Code].....

View 3 Replies

Actionscript 2.0 :: Display Coordinates Of A Random Triangle In It?

Apr 2, 2010

I wanna generate a random triangle with coordinates, which shows the arcs of each corner in actionscript 2.0 with flash 8.0.

View 1 Replies

Flash :: Display The Coordinates Of A Random Triangle In A Graph Which Ranges From +10 To -10 XY Axis?

Apr 3, 2010

how i display the coordinates of a random triangle in a graph which ranges from -10 to +10 in XY axis with the points like A(2,1) etc with arcs in each corner, in actionscript 2.0

View 1 Replies

ActionScript 3.0 :: Collecting User Data?

Aug 24, 2010

I've got to create a form with 2 fields (Name, email adress) that users can type their information into, but i then need to collect the data and store it somewhere (so i would then have a file showing everyone's names and email addresses that have been entered).I have quite a good knowledge of flash front end development but don't know alot about hooking stuff up to xml/php whatever

View 1 Replies

Actionscript 3 :: Collecting And Identifying Functions Within An Array?

Dec 28, 2011

I want to do something where I collect functions to be invoked later when a certain condition is met. E.g.

function doSomething(someArg:Object):void {
if (conditionIsFalse){
operationsToDoWhenConditionIsTrue.push(function(){
doSomething(someArg);

[Code]...

Basically if doSomething is called twice, I only want operationsToDoWhenConditionIsTrue to hold the most recent invocation. Obviously since the invocations are wrapped in function(){} all the functions are the same. Is there any way I can accomplish what I want?

View 1 Replies

ActionScript 3.0 :: Movieclip = Null; Garbage Collecting?

Jul 26, 2010

after strolling through the internet looking for garbage collecting of dynamic movieclips i conceded and justified to myself i should make a forum post.I'm making a small game, with many many explosions. Explosions are random swfs which i cache before using them. Problem is that although i did everything to make them ready for garbage collecting, they seem to overflow the memory.my code:

Code:
package
{
import flash.display.MovieClip;[code]....

the last line, 'e.target.parent=null ', is the way i know how to make movieclips ready for garbage collecting. But if i uncomment the line, I get this error:

Code:
ReferenceError: Error #1074: Illegal write to read-only property parent on example03_fla.MainTimeline.
at Explosions/::doneHandler()
at flash.events::EventDispatcher/

example03_fla is the timeline of the supposed movieclip i'm trying to delete, not the document fla.

View 9 Replies

ActionScript 3.0 :: Trace Object References For Garbage Collecting?

Oct 12, 2009

I'm trying to get my head around optimising AS3 code and clearing things out for garbage collection.

I understand that each time an item is referred to in the code it has its reference count increased by one, so I was wondering if there is a trace option I can use to see how many references each of my objects has?

I can then see where things are getting left behind (if they are) and where I can make optimise better.

I think it would help me work out several issues if I was able to do this

View 1 Replies

ActionScript 3.0 :: Garbage Collecting - Make Sure There Are No Memory Leaks?

Feb 9, 2010

What's necessary to do when removing an object to make sure there are no memory leaks? Do you have to remove all children? Or just remove all event listeners? Or both?

View 1 Replies

ActionScript 3.0 :: TweenLite CPU Optimization - Just Stacking And Never Garbage Collecting?

May 12, 2011

I'm currently working on a game where every "Step" - defined by a global time modifier - everything on screen calculates where it's next position will be, then uses tweenlite to animate itself to that location. This program runs for about 10 seconds before it eats 100% of my CPU. iMac i5 quad core, so it's not the hardware.

The problem is specifically in the following snippet, and the peculiar thing is if I teleport everything to it's next position (i.e. don't tween it there) the CPU is stable at 6% (where flash IDE consumes 4%). Does anyone know why these tweens are just stacking and stacking and never garbage collecting? (This is what I assume the problem is, as I can't find another explanation as to why the problem only exists when i TWEEN to the next location)

[Code]...

View 3 Replies

ActionScript 2.0 :: Flash Maths And Pixels?

Feb 27, 2009

I have a square grid with 100 grid squares in it.I want the cursor to display its grid position.Does Flash plot the position based on pixels - ie would my grid square have to be 100x100px or a multiple of that eg 200x200px? Or could it calculate the position no matter what size the square was? eg 186x186px ?

View 1 Replies

ActionScript 3.0 :: Maths: Exponential Value Via Loop?

Dec 27, 2010

To create a sort of thick-pixel gradient shadow, I've got a simple loop which creates a new 200x5 pixel Shape (rectangle) with each iteration, assigning an alpha value and y value that changes relative to the loop's iteration.

Code:
var upperShadow:Shape = new Shape();
for (var k:int=0; k<10; k++) {
shadowAlpha = (1-(k/10))*.5;
trace(shadowAlpha); // traces .5, .45, .4, .35, .3, .25, .2, .15, .1, .05

[code]....

This creates a simple linear gradient since the alpha value changes linearly, but how would I go about creating some sort of exponential/logarithmic/cubic/circular value for the alpha, so that it falls off differently?

Are there a set of common equations that people use for this sort of thing, similar to the simple (1-(k/10))*.5 I use for the linear change from .5 to 0 in ten .5 increments?

View 3 Replies

ActionScript 2.0 :: Stars Following Animated Mc

Apr 21, 2006

I want to create a dynamically star burst that follows an animated mc. I found this mouse trailer that do the things I want, except it's following the mouse and not a mc.How can I modify the code to make it follow a mc and not the mouse?

View 3 Replies

Flash - Collecting High-volume Video Viewing Data?

Apr 5, 2010

I want to add tracking to our Flash-based media player so that we can provide analytics that show what sections of videos are being watched (at the moment, we just register a view when a video starts playing)

For example, if a viewer watches the first 30 seconds of a video and then clicks away to something else, we want the data to reflect that. Likewise, if someone watches the first 10 seconds, then scrubs the timeline to the last minute of the video and watches that, we want to register viewing on the parts watched and not the middle section.

My first thought was to collect up the viewing data in the player and send it all to the server at the end of a viewing session. Unfortunately, Flash does not seem to have an event that you can hook into when a viewer clicks away from the page the movie is on (probably a good thing - it would be open to abuse)

So, it looks like we're going to have to make regular requests to the server as the video is playing. This is obviously going to lead to a high volume of requests when there are large numbers of simultaneous viewers.

The simple approach of dumping all these 'heartbeat' events from clients to a database feels like it will quickly become unmanageable so I'm wondering whether I should be taking an approach where viewing sessions are cached in memory and flushed to database when they become inactive (based on a timeout). That way, the data could be stored as time spans rather than individual heartbeats.

View 2 Replies

ActionScript 3.0 :: Cascading Particles/stars Etc?

Feb 10, 2009

I need to get something similar to this done in a short period of time, so I don't have much time to play around.

Does anyone have a similar code/tutorial or anything that resembles this?

View 3 Replies

ActionScript 3.0 :: Dynamically Creating And 'zooming' Stars?

Jan 10, 2012

I'm interested in dynamically creating (duplicating) a movie clip of a star and placing it randomly on the stage. It should then grow in size and change it's x & y location so it moves off the stage. (I've attached a file to hopefully show what I'm interested in.)I can hack this out in AS 2.0 but it has to be in AS3 and my old high school programming education just isn't hacking it.

View 1 Replies

ActionScript 2.0 :: Stars/Space Zoom Effect?

Mar 4, 2005

Looking for a zoom through space & starfield effect. I've seen horizontal ones but I am looking for stars coming at you head on. Similar to the snow tutorial. Random generated stars zooming at you....

View 3 Replies

ActionScript 2.0 :: Stars / Space Zoom Effect?

Mar 4, 2005

Looking for a zoom through space & starfield effect. I've seen horizontal ones but I am looking for stars coming at you head on. Similar to the snow tutorial.

View 3 Replies

Flash 10 :: Auto Format - Maths Functions Not Done In Correct Order

Apr 23, 2011

I have some code that looks like this:
ActionScript Code:
level_btn.x = 50 + (i - 1) % 10 * 50;
It sets the x location of my level button. But this is in a for loop (that's what the 'i' is for.) I run it and everything works perfectly, as it should, not a single problem. Then I press the auto format button in the flash actionscript editor. (It's the button that adds all of the ; to the end of each line and other stuff)

Well that changes my code to this:
ActionScript Code:
level_btn.x = 50 + i - 1 % 10 * 50;
thinking it's done me a favour but it hasn't. It's got rid of the brackets so it won't do the maths functions in the correct order. I've tried adding more brackets in places and other stuff but I just don't know how to fix it. It's annoying because every time I press the auto format button I have to add the brackets in again.

View 1 Replies

ActionScript 2.0 :: Can't Figure Out How To Make The Stars Slowly Decrease

May 31, 2005

I'm using the following code to spin a couple stars on the stage when the mouse rolls over them. Can't figure out how to make the stars slowly decrease in speed after the user rolls off though.

[Code]...

View 8 Replies

ActionScript 2.0 :: Simple Maths - Adding And Subtracting An Amout To/from A Balance Amount?

Jun 23, 2008

I have an application performing a simple calculation of adding and subtracting a amout to/from a balance amount.The problem is that every thing works fine except that when i remove the lkast amout from the balance ie: 15.25 -15.25 suppose i get something like -5.32907051820075e-15

View 2 Replies

ActionScript 2.0 :: MX04 - Create A Script Where The User Inputs A Maths Equation (something Simple Like 5 + 2 * 10)?

Aug 1, 2010

I am trying to create a script, where the user inputs a maths equation (something simple like 5 + 2 * 10), I have managed to break down the text into an array and have the numbers in one array and the symbols in another, I wanted the computer to then work it out, however I cant seem to think of how to do this and the methods that I have tried have failed.there is one dynamic box and the value of that is then broken down by an array split(" "), however this leaves the values in an array and it is percieved as a string not a number and so when i try to work it outit just displays 5 * 10, how would i get it to work that out?

View 1 Replies

ActionScript 3.0 :: Maths - When Click On The Knob It Turns 90 Either Left Or Right Depending - Get The Angle In Whole Numbers?

Mar 11, 2011

Code:
knob_mc.addEventListener(MouseEvent.MOUSE_DOWN,turn);
stage.addEventListener(MouseEvent.MOUSE_UP,endTurn );
function turn(e:Event):void[code].....

This is the code I'm using to move a knob the challenge is when i click on the knob it turns 90 either left or right depending where i click, I'd like it to stay still until I turn the knob, and second how do I get the angle in whole numbers??

View 3 Replies

ActionScript 2.0 :: Friction Swinging - Stars Hanging By Strings From The Top Of Flash Document

Dec 19, 2005

I have an idea for something at work. I want to have stars hanging by strings from the top of my flash document. if the user mouses over these stars I want the star to lightly swing in the direction the mouse went over at. Almost as if you had a cardboard star hanging from the ceiling and you tapped it with your hand. I know this probably includes friction but my tests don't seem to work out the way I want. Does anyone know how to achieve this?

View 8 Replies

ActionScript 3.0 :: Make A Reset Button That Re-generates Stars For User To Count Again

Aug 3, 2009

I made this simple AS3 game that generates a random amount of stars on the stage. The user has to count the number of stars, punch that number into the input box and hit submit.The problem is that if the user wants to play again, he/she will have to go through the hassle of closing and re-opening game. That's why i'm now wondering how to make a reset button that re-generates the stars for the user to count again.URL...

View 1 Replies

ActionScript 3.0 :: Mak 3d Field Of Infinite Stars That Can Be Navigated With Mouse Movement / Accelerometer

Feb 5, 2011

I was hoping someone might have found a tutorial or done one on how to make a 3d field of infinite stars that can be navigated with mouse movement or the accelerometer..

View 0 Replies

ActionScript 2.0 :: How To Drag In A Triangle?

Feb 18, 2004

i want to drag my object, but the boundaries have to form a triangle and not the standard rectangle...

View 3 Replies







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