ActionScript 3.0 :: Creating Random Battlefields Like "Tanks"?

Aug 24, 2011

I'm creating a game like "Tanks" but my battlefields are not coming out very well. They look very jagged and not sloping like the game tanks. To give an idea what I am going for... tanks looks like this: [URL]I thought I could do a process like...Create turbidity. The slope may not be higher than this value (positive or negative.)Increase or decrease the slope based on a value between 0 and "turbidity."Somehow stop the terrain from being too high or negative I don't want the terrain to just say, "I'm too high." And snap back. I want a gradual sloping... which I'm not sure how to achieve. While keeping it constrained.Be able to have a symmetrical terrain with gradual slopingIt went well until I get to points 3 and 4. I can't stop my terrain from being too high or driving itself into the ground without it looking terrible. And I can't get a symmetrical terrain without a sharp point in the middle due to a high slope.

View 6 Replies


Similar Posts:


ActionScript 3.0 :: Implement A Feature From A Game Called 'Tanks'?

Oct 2, 2011

I have been trying to implement a feature from a game called 'Tanks' (can be found at: mathsisfun.com/games/tanks) into one of my games. This is where upon shooting and destroying the dirt with explosives, all the dirt above it, where the explosives didn't reach, falls down.I have been trying for a while to get this effect to work, but with no success. My best attempt is atta hard to explain!). Even though the particles of dirt are so much bigger, it still lags like there is no tomorrow.

View 2 Replies

Actionscript 3 :: Creating A Consistent 'random' Value?

Sep 14, 2011

creating consistent random values in actionscript. I assume this would, be by using a consistent seed value

View 1 Replies

ActionScript 2.0 :: Creating Random Movements?

Feb 23, 2004

I was wondering if there was a way to make movements confined to a certain order. I saw a DNA effect, and it was quite awesome.

View 5 Replies

ActionScript 2.0 :: Creating A Random Map Into An Array

Aug 1, 2007

I'm trying to create a program that creates a random map for a side scrolling cave. So I need to store the roof and the grounds y coordinate into a big array, like 10 000 pieces of wall.

The only way I've gotten it to accept some data into the array is like this but I want something cleaner and something that can go on forever.

How should I format the first 4 lines of code so that the array accepts commands like this and expands for the for loop as needed?

[Code]....

View 1 Replies

ActionScript 3.0 :: Creating Random Amount Of Circles?

Nov 19, 2009

i'm "experimenting" a bit with code at the moment and now i have written a class that creates a circle that bounces at the bottom of the stage. Wich has a random size and a random starting point.But now i wan't to expand the code so that i can have a random amount of balls bouncing down, so instead of only one there are f.e. 3 balls.Also i have noticed that the stage.stageHeight does not get updated when i resize my screen when i run iton how to make that happen ?

package {
import flash.display.Stage;
import flash.events.*;

[code]....

View 12 Replies

ActionScript 2.0 :: Creating Semi - Random Movement?

Aug 4, 2009

I'm trying to make a simplegame in which you have to avoid a bunch of angry looking circles as they move across the screen. What should happen is that they all spawn outside of the stage and move across it then when they reach the other side they appear from somewhere else outside the stage So far I have managed to only make them come from one side of the screen by using this script on the enemy

[Code]....

I've tried using a switch() function with a random number to choose which side the enemy comes from but that didn't work it just skipped to default

View 0 Replies

ActionScript 2.0 :: Creating Random Number Every Three Seconds?

Oct 5, 2009

I have the below code used to create a random number every 3 seconds and then have the timeline go whatever numbered frame the random number comes to. It works. However when I trace the randNum, I see that it is generating more and more random numbers during the interval. For ex, first it generates one random number every 3 seconds... but then it starts generating more than one per every 3 seconds. how can this be? Isn't the function supposed to run once every 3 seconds?

setInterval(createRandom,3000);
function createRandom() {
minNum = 1;
maxNum = 3;
randNum = Math.ceil (Math.random () * (maxNum - minNum + 1)) + (minNum - 1);
trace (randNum);
_root.gotoAndPlay (randNum);
};

View 3 Replies

ActionScript 3.0 :: Creating Random Tween Of Certain Object

Aug 23, 2010

What I want to achieve is a script that creates a random tween of a certain object (a button object in this case), within a confined space (i.e. don't move the button out of visibility completely). My basic idea is:

a) for each button (there will be about 5 or 6 buttons in total), get its position.
b) for each button, move (randomly) either left or right by X pixels and (randomly) either up

Or down by Y pixels (where X and Y are random numbers within a specified range, e.g. random number between 10 and 40 pixels for instance). [However, before moving the object, determine if the new coordinate will put the object out of visibility. If it will, repeat step b) until it won't put it out of visibility. if actionscript has while loops, I'm sorted]

c) repeat from a [is there something like javascript's setInterval() for actionscript?].

View 0 Replies

ActionScript 3.0 :: Creating Random Number Of Objects?

Apr 25, 2011

I have an object calls "level" and I want to create random number of objects with random position on the stage.

I've reached how to create random position but I still have only 1 object "level" on my stage.

View 8 Replies

ActionScript 3.0 :: Creating Shapes Out Of Random Lines

Mar 16, 2009

I know it's for sure a complex task, but does anybody out there know a package or a set of algorithms to extract shapes out of set of overlapping lines? I am looking for something in as3 that would resemble adobe illustrator's pathfinder function (most specifically, intersection). SWF here: [URL]. I know it will need some crazy geometric calculation?

View 2 Replies

ActionScript 3.0 :: Creating A Random Card Deck?

Nov 19, 2009

I'm trying to add a second card deck to this matching game, but can't wrap my head around how to set up a second random feature to call one of three arrays.

My problem is that I want to call 6 cards each time I start a new game, but for the sake of not boring people with the imagery, I want to have it so that the card types vary each time they start a new game, meaning flash calls one of three decks. What I've come up with so far is below.. and I included the as file...

var colordeck:Array = new Array(1,1,2,2,3,3,4,4,5,5,6,6);
var colordeck2:Array = new Array(7,7,8,8,10,10,11,11,12,12,13,13);
var colordeck2:Array = new Array(14,14,15,15,16,16,17,17,18,18,19,19);

[Code].....

View 2 Replies

ActionScript 2.0 :: Creating Random Movie Clip?

May 11, 2011

I have a movie clip which i gave instance name "abc" (suppose). I want this movie clip to automatically load randomly on the scene when i load movie. I mean this movie clip should be seen randomly making lots of duplicates scattering all over the document (like stars twinkles randomly all over the sky).

View 1 Replies

Actionscript 3 :: Cs5 - Creating A Game Of Falling Random Objects

Oct 10, 2011

I am attempting to create a game that will simulate groceries coming down a conveyor belt. The player acts as a bagger and must click and drag the groceries into designated bags (one for cold food and one for non-cold food). When the correct choice is made the food will disappear and the score will increase +1.

I have become overwhelmed by thinking about how to do this and have not found helpful answers that actually work when I try to compile them so I decided to ask. how I can have random grocery items fall down the screen? I assumed I could create an array of movieclips and have them be called to fall down randomly, but I am not sure how this would work.

View 2 Replies

ActionScript 2.0 :: Creating Array With Object Using Random Numbers

Mar 5, 2010

I need to create an array with objects when using random numbers. This is the script I have:
ActionScript Code:
if(_root.EnemyCar.hitTest(_root.kill)){
_root.EnemyCar.removeMovieClip();
var lol6 = Math.floor(Math.random()*200);
if (lol6==2){_root.attachMovie("EnemyCar", "EnemyCar", _root.getNextHighestDepth(), {_x:74, _y:-100})};
if (lol6==1){_root.attachMovie("SwatVan1", "SwatVan1", _root.getNextHighestDepth(), {_x:114.9, _y:-45})};
if (lol6==0){_root.attachMovie("OilTanker", "OilTanker", _root.getNextHighestDepth(), {_x:74, _y:-250})};
}
As you can see the random number is from 0-250, I want to be able to have enemycar spawning from 2-20 and other movie clips spawning from 20-40 etc.

View 2 Replies

ActionScript 2.0 :: CS4 Creating A Random Image Generator From A Live Feed

Oct 28, 2009

i am wondering if it is possible, and if someone would be so kind to help me code a scene where two thumbnails, side by side, are flipped up and down, and back up, each time revealing a new random image culled from a feed such as a flickr feed (or any others available, is there a random google image search feed that i dont know about?).if this is possible, i would need assistance in coding the script so that the flash movie is dynamic and pulls image data in real time from the feed, displays it within the two thumbnail cells, and for added headache pain, i would hope to also learn how to code a random image to be selected based on a visitors date/time stamp.i am a graphic designer with rudimentary knowledge of action script 2.0 (yikes!) so please, go slowly / explain yourself. i have searched the forum, but i cannot find any previous threads that combine the random image generator idea with a live feed (unless if i missed it, please point it out to me if you can find such threads).

View 1 Replies

Creating Text On Flash Scene And Rotate With Random Angle

Oct 27, 2010

Flash Tranformation Matrix via JsFL. I have to write a JsFL script that creates a text on my Flash scene, and rotate it with a random angle. Imagine I want to create and rotate a "Hello World!" at 45 degrees, my code looks like that:

rotateAngle = 45;
//creates my new text at x:0, y:0 coordinates
fl.getDocumentDOM().addNewText({left:0, top:0, right:10, bottom:10});
fl.getDocumentDOM().setTextString('Hello World!');
var mat = fl.getDocumentDOM().selection[0].matrix;
[Code] .....

The problem is : the rotation applied to my text is 58.3 instead of 45. I have to admit that I'm kind of noob with matrix... so I used the "matrix transformation for rotation" here : [URL].

View 1 Replies

ActionScript 2.0 :: Creating A Random Equation - Randomly Generate Two Individual Numbers

Aug 28, 2009

how would you go about creating a random equation? i would like to randomly generate two individual numbers, a random operator (out of +, -, *, /) between these numbers and then the user would input a number to answer the equation... any thoughts on this?

View 4 Replies

ActionScript 3.0 :: Creating Two Variables To Store A Maximum And Minimum Value For A Random Number Generator

Dec 22, 2010

So, I'm just starting a bigger AS3 project. I'm still learning AS3, transitioning from AS2 and I keep getting caught up on dumb stuff. I'm creating two variables to store a maximum and minimum value for a random number generator. Here's my code.

[Code]...

View 2 Replies

ActionScript 2.0 :: "Creating Random Colors In Flash 5" Tutorial?

Jan 15, 2006

I have played around with it and made it "rollover" instead of "release".However, i don't really like the random colors selected.Can i choose a certain color series (yellow for instance; light yellow, dark yellow).Or make it turn into a specific number of colors on the same square; it can randomly select from a series of colors i have listed?

View 1 Replies

ActionScript 2.0 :: Creating An Input Text - A Random Number Will Be Typed In That Text Instead Of Having A Fixed, Pre-set Number?

May 13, 2006

I want to change the code a little bit by creating an Input Text. A random number will be typed in that text instead of having a fixed, pre-set number.

View 6 Replies

ActionScript 3.0 :: Get A Random Tag In Xml, And Then Get A Random Value Inside That Random Tag

Dec 17, 2011

Is it putting the first random var and then the second, like this?

frases.push(myXML.pais.frase1[ps][r]);

View 1 Replies

ActionScript 2.0 :: [Flash 8 Pro] Load Random Array Element And Loop For Random Intervals?

Sep 30, 2006

I want a movieclip consisting of a dynamic text box that, from the time it's loaded onto the stage, loads a randomly selected text string from an array, and continues to loop until the clip is removed from the stage. I also want the text strings to appear in the text box for random intervals between 500 and 3000 milliseconds.

While I've found tutorials here and elsewhere on loading one element from an array, usually triggered by a button, I don't know how to combine/alter it with the other elements.So I want this movieclip on the stage randomly flashing phrases from an array, some for a barely perceptible time, and others for a readable time.

View 3 Replies

ActionScript 3.0 :: Loader+Math.random - RandomNumber Not Loading Random Images?

Feb 26, 2012

why is this code NOT loading a random image, despite tracing random number?
 
package {
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.*;
import flash.net.URLRequest;
import flash.display.MovieClip;

[Code]...

View 3 Replies

ActionScript 2.0 :: Math.random - Slide To A New Random X Position When Mc Is Less Than 5 Pixels Away From Its Target

Mar 3, 2004

What I want is for my mc to slide to a new random x position when it is less than 5 pixels away from its target, it keeps doing this. the problem is for some bloody &*�$(()** reason my random numbers only keep going up!! why is this?? i want to produce random numbers between 1 and 770 - this is my code..

[Code]...

View 5 Replies

ActionScript 2.0 :: Putting Data Into An Array Via XML And Then Selecting At Random An Image String To Load In A Pic At Random

Feb 11, 2009

I've been putting data into an array via XML, and then selecting at random an image string to load in a pic at random. But whilst doing this, I wanted to remove the String from the Array that I have just used, so I don't get repetition of the same image in the output. I initially thought that pop would remove the string I had just used - But of course it Removes the last value in the Array instead, which doesn't really help.

Ok - so how about randomizing the data once inside the Array, after it has been pulled in from XML!? That way I can load in the 'last' image, and then pop it out! Keeping a randomized selection of images each time 'it' is loaded

View 2 Replies

ActionScript 2.0 :: What Value Is Seeded To Math.random() To Generate The Random Number

Nov 18, 2010

1) what value is seeded to Math.random() to generate the random number?

View 2 Replies

ActionScript 3.0 :: Random Animation + Random Sounds + Background Music?

Feb 19, 2012

A background music looping in the back, that starts with the opening of the swf and never stops. I think I achieved that with this bit of code :import flash.media.Sound;

import flash.net.URLRequest;
import flash.media.SoundChannel;
bg music[code].....
 
Finally I need to jump from frame to frame randomly to play various animations. For example :Project starts, background music starts playing, we hear random sounds played one after the other, while some animations can be seen on screen, playing in a random order.

View 9 Replies

ActionScript 2.0 :: [FMX] Random Easing - Move The Different Squares Random With A Interval

Aug 1, 2004

I have a picture on the stage covered by 12 squares (sq1, sq2, sq3.......sq12)
When the movie opens I want the squares to move down, but i want a random sequence ( 3, 9, 2, 12...........8). I already made de function for the movement:

[Code]...

View 6 Replies

ActionScript 2.0 :: Load Random Movie (but Loading A Random Xml File Instead)

Aug 17, 2007

im playing with the load random movie (but loading a random xml file instead) based on the wonderful tutorial from front page and was wondering whether anyone can show me the work around/upgrade to AS2 for this bit of script since im publishing to Flash 8 /AS2 and it doesnt work:

[Code]....

View 5 Replies







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