Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Random Scrolling Terrain



How can i make a flash movie that generates random scrolling terrain?



KirupaForum > Flash > Flash 8 (and earlier) > Flash MX 2004
Posted on: 07-16-2004, 07:36 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Random Scrolling Terrain
How can i make a flash movie that generates random scrolling terrain?

Random Terrain?
Hey guys, im st1k from newgrounds and I was looking at making a game like copter but how did he make that random terrain in his game can someone please tell me?

Random Terrain
I currently have 3 movieclips in the library and i want 1 to appear randomly on stage at runtime. So that a different one appears everytime. I also want the movieclips to appear at a fixed point on the stage as they are acting as the ground in the game. i have come up with this code but know it is wrong and i get 1067: Implicit coercion of a value of type Array to an unrelated type flash.display:displayObject.

var ground:Array = [Ground, GroundRamp, Ground0];
ground.x = -1.1
ground.y = 400.6;

addEventListener(Event.ENTER_FRAME, randomTerrain);

function randomTerrain(evt:Event):void{
ground.Math.random *= ground;
addChild(ground);
}

Can anyone help?

Scrolling Terrain Using HitTest
i'm trying to make my game so when you go halfway forward on the screen, the terrain starts to scroll and the player does not.

I tried this:
if (scroll.hitTest( _x, true)) {
tellTarget("_parent.Land_mc"){
if (Key.isDown(Key.LEFT)){
_x += 5
}
if (Key.isDown(Key.LEFT)){
_x -= 5
}
}
}

it doesnt seem to work.
please help
thank you

Using 3 Different Movieclips To Generate Random Terrain
I am currently creating a side on off road driving game. I have 3 different move clips of varying landscape, called ground0_mc, ground1_mc and ground2_mc. what i want to do is randomly load one of these on runtime so the landscape always looks a bit different everytime you start the game. Also, when you push the forward button the ground movieclip moves backwards to give the illusion of the car moving forward. However, it is not long before the ground movieclip runs out. i have been trying to make it so that one of the other ground movieclips loads when the current ground movieclip gets to a certain place on the stage, so in theory the car could carry on driving forever. Does anyone know how to do this?

Destructable Terrain?
I was working on THIS,
and I was wondering if it's possible to make the terrain go invisible/away after I "shoot" it??


(I'd search, but it doesn't work -- EVERYTIME it ALWAYS times out and NEVER shows anything else.)

thx
Phallex

Help With Terrain Thing Plz
Hey ppl, I wanted to make a flash thing where a ball would hit a mountain and be able to make an imprint in it. It works through a series of points making up the terrain that are each being checked for hitTest. So I made this thing and when I test it out, it's a little slow...
I was just wondering if there was any way that I could speed it it up, or if not, if there's any way I can change the way that it works so that it won't be so slow.
So if someone could check out the flash file and throw ideas out there of how to make it more efficient, then that would be great
-thx

Attachment below:

[F8] Destructible Terrain
How would I make destructible terrain in Flash 8?

And is it possible to use the eraser tool via actionscript, and then rub out part of a movieClip?

Thank you in advance!

Destructable Terrain
When i say destructable terrain, i mean like that of worms . .

So, I know it is possible to make destructable terrain in flash, probably with its bitmap features. But i have no idea how to do it, can anyone shed some light on this?

Terrain Generator
So my bro and I are working on a game called Battle Tanks, that's based on an old Mac tank game. After successfully programming the game for a TI-83 Plus, I figured it was time to move up to a Flash version. Then we hit this wall: we need to figure out how to generate a smooth curved terrain, but also be able to remove chunks out when the projectiles hit the terrain. This was fairly easy on the calculator, but I'm not quite sure how to approach it with Flash. I have two ideas: first, use API to draw the curves and fill down (then remove fill when projectile hits,) and two, do it like I did on the calculator by drawing a series of lines from the top of the terrain down, and remove the tops of those lines to create a smooth-looking crater...
I used a series of half-cosine curves for the calc program, but how would I do the same with ActionScript? Any help is appreciated. Thanks.

e::

(P.S. An almost perfect example of the desired end-result can be found at http://www.mathsisfun.com/games/tanks.swf)

Terrain Generator
Hello everybody...

I am trying to make a terrain engine in flash. The code is short, results are satisfying, but rendering time isn't.
Please do not abort the script...

Can someone help me?










Attach Code

import flash.display.BitmapData;

//change value to change the size of terrain
var dol:Number=800; //width
var vis:Number=600; //height
//create bitmap and create random heightmap using perlin noise
var bitmapa_01:BitmapData = new BitmapData(dol, vis, false, 0xFFCCCCCC);
var mc_1:MovieClip = this.createEmptyMovieClip("mc", this.getNextHighestDepth());
mc_1.attachBitmap(bitmapa_01, this.getNextHighestDepth());
var randomNum:Number = Math.floor(Math.random() * 100);
bitmapa_01.perlinNoise(dol, vis, 456, randomNum, true, true, 1, false , null);
var vodo:Number; //width
var navp:Number; //height
/*
Problemi:
1. ÄŒe je mapa prevelika, predolgo renderira...

Rešitve:
1. Spremeni renderiranje ???
*/

//Zamenjaj pixle, da narediš teren



for (navp = 0; navp <= vis; navp++){
for(vodo = 0; vodo <= dol; vodo++){
var num = (bitmapa_01.getPixel32(vodo, navp) >> 16 & 0xFF).toString(10);
var visina = parseInt(num);

//morje
if(visina >= 0 & visina <= 120){
var barva = "0x000000" + (visina+60).toString(16).toUpperCase();
bitmapa_01.setPixel32(vodo, navp, barva);
}

//pesek
else if(visina >= 120 & visina <= 128){
var barva = "0x00FF" + (visina+Math.floor(((Math.random()*100)/2+40))).toString(16).toUpperCase() + "00";
bitmapa_01.setPixel32(vodo, navp, barva);
}

//meja pesek - trava
else if(visina >= 128 & visina <= 130){
var rand = Math.floor(Math.random()*100);
if (rand <= 50){
var barva = "0x00FF" + (visina+50).toString(16).toUpperCase() + "00";
}
else if (rand > 50){
var barva = "0x0000" + (visina).toString(16).toUpperCase() + "00";
}
bitmapa_01.setPixel32(vodo, navp, barva);
}

//trava
else if(visina >= 130 & visina <= 159){
var barva = "0x0000" + (visina).toString(16).toUpperCase() + "00";
bitmapa_01.setPixel32(vodo, navp, barva);
}

//meja trava - gore
else if(visina >= 159 & visina <= 160){
var rand = Math.floor(Math.random()*100);
if (rand <= 50){
var barva = "0xFF" +(visina).toString(16).toUpperCase() + (visina).toString(16).toUpperCase() + (visina).toString(16).toUpperCase();
}
else if (rand > 50){
var barva = "0x0000" + (visina).toString(16).toUpperCase() + "00";
}
bitmapa_01.setPixel32(vodo, navp, barva);
}

//gore
else if(visina > 160 & visina <= 168){
var barva = "0xFF" +(visina).toString(16).toUpperCase() + (visina).toString(16).toUpperCase() + (visina).toString(16).toUpperCase();
bitmapa_01.setPixel32(vodo, navp, barva);
}

//meja gore - led
else if(visina >= 168 & visina <= 170){
var rand = Math.floor(Math.random()*100);
if (rand <= 50){
var barva = "0xFF" +(visina).toString(16).toUpperCase() + (visina).toString(16).toUpperCase() + (visina).toString(16).toUpperCase();
}
else if (rand > 50){
var barva = "0xFF" +(visina+40).toString(16).toUpperCase() + (visina+40).toString(16).toUpperCase() + (visina+40).toString(16).toUpperCase();
}
bitmapa_01.setPixel32(vodo, navp, barva);
}

//led
else if(visina > 170 & visina <= 255){
var barva = "0xFF" +(visina+40).toString(16).toUpperCase() + (visina+40).toString(16).toUpperCase() + (visina+40).toString(16).toUpperCase();
bitmapa_01.setPixel32(vodo, navp, barva);
}


}
}

Destructable Terrain ...
Hello everyone,

Most of you probably don't know me, but I run a very poorly visited actionscript portfolio. Been active in Flash for some time in the past, and a hobbist scripter nowadays.

However, I'm facing a very annoying problem with ActionScript that I can't seem to figure out. I'm creating somewhat of a game, which has destructable terrains. Since I am not a game developer, I have no idea how this principle works, but to use it with vectorized object, I did it as follows:

All the terrains in my game a created dynamically, and every corner in those object is stored in an array. A loop run past all the points, and draws the object (API). This enabled me to use hittest. When I shoot at the terrain, the positions of the (affected) points are shifted into the right directions.

The problem I am facing now, is that I do not want my terrain to be as static it is now. For example, (and this is critical in my game), I want to be able to shoot a circle in half... Look at this: (also gives more depth on my destructable terrain theorie)

this is my circle:


here is the point I am going to collide:


the speed and mass of the bullet determen the range of affected points:


finally the points are shifted:


This works great, I am pretty proud of this method, for it is fast, easy to calculate. However, my problem is when I shoot my circle in half, I cannot draw it correctly anymore. I need to be able to trace when I have more then one part, and split the array up into more arrays... Otherwise, the two parts will always be connected with each other...

I do not expect a solution, but I would like some of you to help me brainstorm. How can I construct this so that it works the way I want?

Everybody many thanks,


An oldy: Eric Jr.

[FMX] Terrain Programming
Hello, I don't know how many of you have seen the game in the kirupaLab "Blast a Footer" but I found it very impressive.

http://web.mit.edu/kirupa/www/Game%20Contest/42.htm

I can't seem to figure out for the life of me where I would start with making this type of game. I can easily get the terrain to 'disapear' with masks and whatnot but to get a vehicle to follow the terrain, even after it's been blown to pieces - I am clueless. I have plenty of experience in tile based programming, but I've never approached collisions with a bezier curver. If anyone can help me or point me in the right direction, I'd be very appreciative.

Thanks for your time,
-Andy

Destructable Terrain
How do you make destructable terrain in a game?

Terrain Scroller
I was unable to find any good tutorials or hints on terrain scrollers that isn't random.. like a huge world, and a map that points where on the map you are...
I have no clue about how that could work.

Terrain Moving Through My Guy
Ok, now i have a bad problem.

I have the code:


Quote:




onClipEvent (enterFrame) {
with (_root.player) {

// Controls Player Speed
mySpeed = 3;

// Controls how far the Player bounces off the wall after impact
myBounce = 3;

// keyboard controls
if (Key.isDown(Key.DOWN)) {
_y -= mySpeed;
}
if (Key.isDown(Key.UP)) {
_y += mySpeed;
}
if (Key.isDown(Key.LEFT)) {
_x += mySpeed;
}
if (Key.isDown(Key.RIGHT)) {
_x -= mySpeed;
}

// detect if edges of the player is colliding with the Maze Walls
if (walls.hitTest(getBounds(_root).xMax, _y, true)) {
_x -= myBounce;
}
if (walls.hitTest(getBounds(_root).xMin, _y, true)) {
_x += myBounce;
}
if (walls.hitTest(_x, getBounds(_root).yMax, true)) {
_y -= myBounce;
}
if (walls.hitTest(_x, getBounds(_root).yMin, true)) {
_y += myBounce;
}

// detect if Maze is finished
if (_root.end.hitTest(_x, getBounds(_root).yMax, true)) {
_root.gotoAndStop(3);
}
}
}




and ive labeled my maze's instance name as "player", and my guy as "walls", but my terrain keeps walking through my guy >.<''

Destroying Terrain
i got a game with two peoples who can shoot at each other

when they shoot, if it goes on the terrain, is it possible to make a hole in the terrain?

i've heard about blendmode but i'm not sure that it will work

Destructable Terrain ...
Hello everyone,

Most of you probably don't know me, but I run a very poorly visited actionscript portfolio. Been active in Flash for some time in the past, and a hobbist scripter nowadays.

However, I'm facing a very annoying problem with ActionScript that I can't seem to figure out. I'm creating somewhat of a game, which has destructable terrains. Since I am not a game developer, I have no idea how this principle works, but to use it with vectorized object, I did it as follows:

All the terrains in my game a created dynamically, and every corner in those object is stored in an array. A loop run past all the points, and draws the object (API). This enabled me to use hittest. When I shoot at the terrain, the positions of the (affected) points are shifted into the right directions.

The problem I am facing now, is that I do not want my terrain to be as static it is now. For example, (and this is critical in my game), I want to be able to shoot a circle in half... Look at this: (also gives more depth on my destructable terrain theorie)

this is my circle:


here is the point I am going to collide:


the speed and mass of the bullet determen the range of affected points:


finally the points are shifted:


This works great, I am pretty proud of this method, for it is fast, easy to calculate. However, my problem is when I shoot my circle in half, I cannot draw it correctly anymore. I need to be able to trace when I have more then one part, and split the array up into more arrays... Otherwise, the two parts will always be connected with each other...

I do not expect a solution, but I would like some of you to help me brainstorm. How can I construct this so that it works the way I want?

Everybody many thanks,


An oldy: Eric Jr.

[FMX] Terrain Programming
Hello, I don't know how many of you have seen the game in the kirupaLab "Blast a Footer" but I found it very impressive.

http://web.mit.edu/kirupa/www/Game%20Contest/42.htm

I can't seem to figure out for the life of me where I would start with making this type of game. I can easily get the terrain to 'disapear' with masks and whatnot but to get a vehicle to follow the terrain, even after it's been blown to pieces - I am clueless. I have plenty of experience in tile based programming, but I've never approached collisions with a bezier curver. If anyone can help me or point me in the right direction, I'd be very appreciative.

Thanks for your time,
-Andy

Destructable Terrain
How do you make destructable terrain in a game?

Need To Fill AS Terrain Mesh.. Please Help
So I have this hunk of code, which makes a wireframe (to be used as a terrain mesh). (Edited: Down to) One question: How do I do bitmapped fills with code? I can't find anything on it in the Flash documentation. For that matter,

Code below. Thanks,
-azn

Edit 2: Code now the same as mine. No mesh deformation, straight pillars instead.

------
Code:

b = 1;
c = 1;
d = 1;
//a = new Array(new Array(b, b, b, b, c), new Array(b, 0, c, 0, c), new Array(b, 0, d, d, c), new Array(b, 0, d, d, c), new Array(b, 0, b, 0, c));
a = new Array(new Array(2, 5, 2), new Array(1, 1.5, 2), new Array(1, 1, 1), new Array(2, 1.5, 1),new Array(2,2,2));
baseX = 150;
baseY = 50;
theta = 30;
segLen = 75;
yScale = 0.5;
renderMeshDeform = false;
z = 80;
lines = true;
drawGeometry(a, baseX, baseY, segLen, theta);
function drawGeometry(a, baseX, baseY, segLen, theta) {
_ _v = new Array();
_ _t = new Array();
_ _vMaxX = a[0].length;
_ _vMaxY = a.length;
_ _if (renderMeshDeform) {
_ __ _// Ok, make the array filled with vertices. (MESH DEFORM)
_ __ _for (j=0; j<=vMaxY; j++) {
_ __ __ _v.push(new Array());
_ __ __ _for (i=0; i<=vMaxX; i++) {
_ __ __ __ _x = baseX+(i*segLen)-(j*segLen*Math.cos(toRadians(theta)));
_ __ __ __ _if (i<vMaxX && j<vMaxY) {
_ __ __ __ __ _y = baseY+((j*segLen*Math.sin(toRadians(theta)))-(a[j][i]*segLen*yScale));
_ __ __ __ _} else if (j<vMaxY) {
_ __ __ __ __ _y = v[j][(v[j].length)-1].y;
_ __ __ __ _} else {
_ __ __ __ __ _y = v[j-1][i].y+(segLen*Math.sin(toRadians(theta)));
_ __ __ __ _}
_ __ __ __ _v[j].push(newPoint(x, y));
_ __ __ _}
_ __ _}
_ __ _// Fill an array full of tiles.
_ __ _for (i=0; i<vMaxY; i++) {
_ __ __ _for (j=0; j<vMaxX; j++) {
_ __ __ __ _o = new Object();
_ __ __ __ _// A tile
_ __ __ __ _o.ul = new Object();
_ __ __ __ _// Tile's upper-left vertex
_ __ __ __ _o.ur = new Object();
_ __ __ __ _// Tile's upper-right vertex
_ __ __ __ _o.ll = new Object();
_ __ __ __ _// Tile's lower-left vertex
_ __ __ __ _o.lr = new Object();
_ __ __ __ _// Tile's lower-right vertex
_ __ __ __ _o.ul.x = v[i][j].x;
_ __ __ __ _o.ul.y = v[i][j].y;
_ __ __ __ _o.ur.x = v[i][j+1].x;
_ __ __ __ _o.ur.y = v[i][j+1].y;
_ __ __ __ _o.ll.x = v[i+1][j].x;
_ __ __ __ _o.ll.y = v[i+1][j].y;
_ __ __ __ _o.lr.x = v[i+1][j+1].x;
_ __ __ __ _o.lr.y = v[i+1][j+1].y;
_ __ __ __ _// Now store some other things about the tile, like its matrix position.
_ __ __ __ _o.tilePos = new Object();
_ __ __ __ _o.tilePos.i = i;
_ __ __ __ _o.tilePos.j = j;
_ __ __ __ _// Set standable if it's not a vertical "hole-filler" tile.
_ __ __ __ _o.standable = true;
_ __ __ __ _o.tileHeight = a[i][j];
_ __ __ __ _t.push(o);
_ __ __ _}
_ __ _}
_ _} else {
_ __ _// This is a whole lot easier.
_ __ _for (i=0; i<vMaxY; i++) {
_ __ __ _for (j=0; j<vMaxX; j++) {
_ __ __ __ _o = new Object();
_ __ __ __ _o.ul = new Object();
_ __ __ __ _o.ur = new Object();
_ __ __ __ _o.ll = new Object();
_ __ __ __ _o.lr = new Object();
_ __ __ __ _o.ul.x = baseX+(j*segLen)-(i*segLen*Math.cos(toRadians(theta)));
_ __ __ __ _o.ul.y = baseY+(i*segLen*Math.sin(toRadians(theta)))-(a[i][j]*segLen*yScale);
_ __ __ __ _o.ur.x = o.ul.x+segLen;
_ __ __ __ _o.ur.y = o.ul.y;
_ __ __ __ _o.ll.x = o.ul.x-(segLen*Math.cos(toRadians(theta)));
_ __ __ __ _o.ll.y = o.ul.y+(segLen*Math.sin(toRadians(theta)));
_ __ __ __ _o.lr.x = o.ll.x+segLen;
_ __ __ __ _o.lr.y = o.ll.y;
_ __ __ __ _o.tilePos = new Object();
_ __ __ __ _o.tilePos.i = i;
_ __ __ __ _o.tilePos.j = j;
_ __ __ __ _o.standable = true;
_ __ __ __ _o.tileHeight = a[i][j];
_ __ __ __ _t.push(o);
_ __ __ __ _// Draw the connecting tiles to the one below if necessary.
_ __ __ __ _if ((i<(vMaxY-1)) && (j<(vMaxX-1))) {
_ __ __ __ __ _// Somewhere in the middle.
_ __ __ __ __ _if (a[i][j] != a[i+1][j]) {
_ __ __ __ __ __ _// Draw vertical connector.
_ __ __ __ __ __ _p = new Object();
_ __ __ __ __ __ _p.standable = false;
_ __ __ __ __ __ _// Get that out of the way
_ __ __ __ __ __ _p.lr = new Object();
_ __ __ __ __ __ _p.ll = new Object();
_ __ __ __ __ __ _p.ur = new Object();
_ __ __ __ __ __ _p.ul = new Object();
_ __ __ __ __ __ _p.ul.x = o.ll.x;
_ __ __ __ __ __ _p.ul.y = o.ll.y;
_ __ __ __ __ __ _p.ur.x = o.lr.x;
_ __ __ __ __ __ _p.ur.y = o.lr.y;
_ __ __ __ __ __ _p.ll.x = p.ul.x;
_ __ __ __ __ __ _p.ll.y = p.ul.y+((o.tileHeight-a[i+1][j])*segLen*yScale);
_ __ __ __ __ __ _p.lr.x = p.ur.x;
_ __ __ __ __ __ _p.lr.y = p.ll.y;
_ __ __ __ __ __ _t.push(p);
_ __ __ __ __ _}
_ __ __ __ __ _if (a[i][j] != a[i][j+1]) {
_ __ __ __ __ __ _p = new Object();
_ __ __ __ __ __ _p.standable = false;
_ __ __ __ __ __ _// Get that out of the way
_ __ __ __ __ __ _p.lr = new Object();
_ __ __ __ __ __ _p.ll = new Object();
_ __ __ __ __ __ _p.ur = new Object();
_ __ __ __ __ __ _p.ul = new Object();
_ __ __ __ __ __ _p.ul.x = o.lr.x;
_ __ __ __ __ __ _p.ul.y = o.lr.y;
_ __ __ __ __ __ _p.ur.x = o.ur.x;
_ __ __ __ __ __ _p.ur.y = o.ur.y;
_ __ __ __ __ __ _p.ll.x = p.ul.x;
_ __ __ __ __ __ _p.ll.y = p.ul.y+((o.tileHeight-a[i][j+1])*yScale*segLen);
_ __ __ __ __ __ _p.lr.x = p.ur.x;
_ __ __ __ __ __ _p.lr.y = p.ur.y+((o.tileHeight-a[i][j+1])*yScale*segLen);
_ __ __ __ __ __ _t.push(p);
_ __ __ __ __ _}
_ __ __ __ _} else if (i<(vMaxY-1)) {
_ __ __ __ __ _// Right edge. Draw down to zero (floor).
_ __ __ __ __ _if (a[i][j] != a[i+1][j]) {
-----------------------------

the rest of the code will not fit here, so it is at the next thread , i'll call it "terrain map code part 2"

thanks

Moving Over Terrain Interactively
Hry,
basically im making a game where you need to catch these little animal things, and i want to be able to just write some code into the animals to detect the terrain theyr moving over, and they run left, for instance, then if the terrain moves up a pixel, so do they. Ideally id need the terrain to be one big MC, not lots of different ones on the different levels, so anyone know how to do that?

something like detecting if the terrain is to the left, and if it is, then checking up, and if its not, then going up, and if it is, then going down. ??

any info appreciated :P

AS 2.0 btw

beedle

Z-Ground Terrain Demo
This demo was to test my way of rendering terrain in z-ground engine.
The result is not very satisfactory but at least it prove that my way works!
But after some optimazation it will be usable, I think.
It looks like some kind of voxel rendering effect but actually not.


(I also write one 3D Voxel Terrain engine using as3.0, if you are interested, here it is(with code))
Again, this swf was created by pure code, the textures were generated by my texture generator engine.
By the way, my next demo, which is almost done, is about lighting and shadow, water reflection effect of z-ground engine.
Demo:HERE(arraow key to move)
(BE CAREFUL!It needs lots of time for pre-rendering,to avoid crashing you computer,download it and use a flash player to view )

[Disc]Different Way For Destructable Terrain?
Hey guys I was just wondering if there is a more efficiant way to doing destructable terrain, other than adding an MC to wher eyou want the terrain to be "destroyed". Cos if there is too many MC's on stage then flash player slows down.

Is there any other way that wont make flash player lag like a mofo?

(Casual) Terrain Detection: HELP ME.
Help.

I can't explain this too well, but here's what I'm trying to do: I want 100 or so little dots to follow the leader, which the user controls with arrow keys. Inspired by Pikmin. I've got all that down. Let's throw in some terrain.

Turns out that terrain is a real [insert favorite obscenity here]. Especially when you have so many movie clips that are affected. All I could crank out without crashing the swf was to simply move the dot to the last position in which it was NOT touching any terrain, and just leave it there. This results in the dots getting, sort of, STUCK ... words escape me:

It's plain what paths the dots should be taking to reach their leader, but in this example they remain UNMOVING. So they would need some kind of pahfinding algorithm to make their way around things. Nothing complex; if there's a wall between the dot and the leader, a barrier whose surface is perpendicular to the path from the dot to the leader, the dot should just give up and sit there. But if minimal moving around would get the dot to the leader, let it be.

If anyone could help, I'd be in your debt -- no, I'd worship you.

The FLA is here.

The actions concerning collision and movement are in the library, in the pikmin MC.

Scrollable Terrain W/ Objects
Ok, so I'm making a overhead game and I want to make the terrain movable. But the only problem, I have objects which the player hitTest on it. So how do I make everything scrollable?

Terrain Park Sites
I am looking for some inspiration for a site I am developing similar to http://vail.snow.com/info/mtn.sb.asp (click the Golden Peak Terrain park link)


If anyone has some links to similar sites please post.

Thanks in advance.

AS Terrain Mesh Code (part 2)
here is the rest of the code:

------------------------
_ __ __ __ __ __ _// Draw vertical connector.
_ __ __ __ __ __ _p = new Object();
_ __ __ __ __ __ _p.standable = false;
_ __ __ __ __ __ _// Get that out of the way
_ __ __ __ __ __ _p.lr = new Object();
_ __ __ __ __ __ _p.ll = new Object();
_ __ __ __ __ __ _p.ur = new Object();
_ __ __ __ __ __ _p.ul = new Object();
_ __ __ __ __ __ _p.ul.x = o.ll.x;
_ __ __ __ __ __ _p.ul.y = o.ll.y;
_ __ __ __ __ __ _p.ur.x = o.lr.x;
_ __ __ __ __ __ _p.ur.y = o.lr.y;
_ __ __ __ __ __ _p.ll.x = p.ul.x;
_ __ __ __ __ __ _p.ll.y = p.ul.y+((o.tileHeight-a[i+1][j])*segLen*yScale);
_ __ __ __ __ __ _p.lr.x = p.ur.x;
_ __ __ __ __ __ _p.lr.y = p.ll.y;
_ __ __ __ __ __ _t.push(p);
_ __ __ __ __ _}
_ __ __ __ __ _p = new Object();
_ __ __ __ __ _p.standable = false;
_ __ __ __ __ _// Get that out of the way
_ __ __ __ __ _p.lr = new Object();
_ __ __ __ __ _p.ll = new Object();
_ __ __ __ __ _p.ur = new Object();
_ __ __ __ __ _p.ul = new Object();
_ __ __ __ __ _p.ul.x = o.lr.x;
_ __ __ __ __ _p.ul.y = o.lr.y;
_ __ __ __ __ _p.ur.x = o.ur.x;
_ __ __ __ __ _p.ur.y = o.ur.y;
_ __ __ __ __ _p.ll.x = p.ul.x;
_ __ __ __ __ _p.ll.y = p.ul.y+(o.tileHeight*yScale*segLen);
_ __ __ __ __ _p.lr.x = p.ur.x;
_ __ __ __ __ _p.lr.y = p.ur.y+(o.tileHeight*yScale*segLen);
_ __ __ __ __ _t.push(p);
_ __ __ __ _} else if (j<(vMaxX-1)) {
_ __ __ __ __ _// Bottom edge. Draw to zero.
_ __ __ __ __ _if (a[i][j] != a[i][j+1]) {
_ __ __ __ __ __ _p = new Object();
_ __ __ __ __ __ _p.standable = false;
_ __ __ __ __ __ _// Get that out of the way
_ __ __ __ __ __ _p.lr = new Object();
_ __ __ __ __ __ _p.ll = new Object();
_ __ __ __ __ __ _p.ur = new Object();
_ __ __ __ __ __ _p.ul = new Object();
_ __ __ __ __ __ _p.ul.x = o.lr.x;
_ __ __ __ __ __ _p.ul.y = o.lr.y;
_ __ __ __ __ __ _p.ur.x = o.ur.x;
_ __ __ __ __ __ _p.ur.y = o.ur.y;
_ __ __ __ __ __ _p.ll.x = p.ul.x;
_ __ __ __ __ __ _p.ll.y = p.ul.y+((o.tileHeight-a[i][j+1])*yScale*segLen);
_ __ __ __ __ __ _p.lr.x = p.ur.x;
_ __ __ __ __ __ _p.lr.y = p.ur.y+((o.tileHeight-a[i][j+1])*yScale*segLen);
_ __ __ __ __ __ _t.push(p);
_ __ __ __ __ _}
_ __ __ __ __ _p = new Object();
_ __ __ __ __ _p.standable = false;
_ __ __ __ __ _// Get that out of the way
_ __ __ __ __ _p.lr = new Object();
_ __ __ __ __ _p.ll = new Object();
_ __ __ __ __ _p.ur = new Object();
_ __ __ __ __ _p.ul = new Object();
_ __ __ __ __ _p.ul.x = o.ll.x;
_ __ __ __ __ _p.ul.y = o.ll.y;
_ __ __ __ __ _p.ur.x = o.lr.x;
_ __ __ __ __ _p.ur.y = o.lr.y;
_ __ __ __ __ _p.ll.x = p.ul.x;
_ __ __ __ __ _p.ll.y = p.ul.y+(o.tileHeight*yScale*segLen);
_ __ __ __ __ _p.lr.x = p.ur.x;
_ __ __ __ __ _p.lr.y = p.ll.y;
_ __ __ __ __ _t.push(p);
_ __ __ __ _} else {
_ __ __ __ __ _// Bottom right corner. Draw not one, but two panels to finish
_ __ __ __ __ _// everything off.
_ __ __ __ __ _// Draw bottom edge rectangle.
_ __ __ __ __ _p = new Object();
_ __ __ __ __ _p.standable = false;
_ __ __ __ __ _// Get that out of the way
_ __ __ __ __ _p.lr = new Object();
_ __ __ __ __ _p.ll = new Object();
_ __ __ __ __ _p.ur = new Object();
_ __ __ __ __ _p.ul = new Object();
_ __ __ __ __ _p.ul.x = o.ll.x;
_ __ __ __ __ _p.ul.y = o.ll.y;
_ __ __ __ __ _p.ur.x = o.lr.x;
_ __ __ __ __ _p.ur.y = o.lr.y;
_ __ __ __ __ _p.ll.x = p.ul.x;
_ __ __ __ __ _p.ll.y = p.ul.y+(o.tileHeight*yScale*segLen);
_ __ __ __ __ _p.lr.x = p.ur.x;
_ __ __ __ __ _p.lr.y = p.ll.y;
_ __ __ __ __ _t.push(p);
_ __ __ __ __ _// Draw right edge rectangle.
_ __ __ __ __ _p = new Object();
_ __ __ __ __ _p.standable = false;
_ __ __ __ __ _// Get that out of the way
_ __ __ __ __ _p.lr = new Object();
_ __ __ __ __ _p.ll = new Object();
_ __ __ __ __ _p.ur = new Object();
_ __ __ __ __ _p.ul = new Object();
_ __ __ __ __ _p.ul.x = o.lr.x;
_ __ __ __ __ _p.ul.y = o.lr.y;
_ __ __ __ __ _p.ur.x = o.ur.x;
_ __ __ __ __ _p.ur.y = o.ur.y;
_ __ __ __ __ _p.ll.x = p.ul.x;
_ __ __ __ __ _p.ll.y = p.ul.y+(o.tileHeight*yScale*segLen);
_ __ __ __ __ _p.lr.x = p.ur.x;
_ __ __ __ __ _p.lr.y = p.ur.y+(o.tileHeight*yScale*segLen);
_ __ __ __ __ _t.push(p);
_ __ __ __ _}
_ __ __ _}
_ __ _}
_ _}
_ _tileCount = 1;
_ _for (i=0; i<t.length; i++) {
_ __ _drawTile(t[i], tileCount);
_ __ _tileCount++;
_ _}
}
function drawTile(tile, layer) {
_ _createEmptyMovieClip("tile"+layer, layer);
_ _with (eval("tile"+layer)) {
_ __ _moveTo(tile.ul.x, tile.ul.y);
_ __ _if (lines) {
_ __ __ _lineStyle(1, 0x000000, 100);
_ __ _}
_ __ _beginFill("0xCCCCCC", z);
_ __ _lineTo(tile.ur.x, tile.ur.y);
_ __ _lineTo(tile.lr.x, tile.lr.y);
_ __ _lineTo(tile.ll.x, tile.ll.y);
_ __ _lineTo(tile.ul.x, tile.ul.y);
_ __ _endFill();
_ _}
_ _(eval("tile"+layer)).myself = eval("tile"+layer);
_ _(eval("tile"+layer)).tile = tile;
_ _// Let's save that.
_ _(eval("tile"+layer)).onRelease = function() {
_ __ _if (tile.standable) {
_ __ __ _trace("Clicked: ("+tile.tilePos.i+","+tile.tilePos.j+"), height "+tile.tileHeight);
_ __ __ _createEmptyMovieClip("highlight", 300);
_ __ __ _with (eval("highlight")) {
_ __ __ __ _moveTo(tile.ul.x, tile.ul.y+1);
_ __ __ __ _lineStyle(1, 0x000000, 100);
_ __ __ __ _beginFill("0xFF0000", 50);
_ __ __ __ _lineTo(tile.ur.x, tile.ur.y+1);
_ __ __ __ _lineTo(tile.lr.x, tile.lr.y+1);
_ __ __ __ _lineTo(tile.ll.x, tile.ll.y+1);
_ __ __ __ _lineTo(tile.ul.x, tile.ul.y+1);
_ __ __ __ _endFill();
_ __ __ _}
_ __ _}
_ _};
}
function newPoint(x, y) {
_ _o = new Object();
_ _o.x = x;
_ _o.y = y;
_ _return o;
}
function toRadians(d) {
_ _return (Math.PI/180*d);
}
function rotateMatrixCW(a) {
_ _// Returns a rotated clockwise 90 degrees.
_ _b = new Array();
_ _for (i=0; i<a[0].length; i++) {
_ __ _b.push(new Array());
_ __ _for (j=0; j<a.length; j++) {
_ __ __ _b[i].push(a[a.length-1-j][i]);
_ __ _}
_ _}
_ _return b;
}
function rotateMatrixCCW(a) {
_ _// Returns a rotated counterclockwise 90 degrees.
_ _b = new Array();
_ _for (i=0; i<a[0].length; i++) {
_ __ _b.push(new Array());
_ __ _for (j=0; j<a.length; j++) {
_ __ __ _b[i].push(a[j][a[0].length-1-i]);
_ __ _}
_ _}
_ _return b;
}
-----------------------


thanks in advance for your help..

-azn

Some Platformer/Destructable Terrain Problems
Ok, I attached my platform/destructable terrain test thingy which I am happy and surprised worked. (to play, arrow keys are move and jump, and click and drag to shoot a "bullet" that desroys terrain)
But, as you can see, there are quite a few problems.Going up a hill is fine, but when going down the player doen't cling to the ground.
Even if there if there is a massive 90 degree wall you can still go up it.
If you are inside a 'hole' even if there is ground above you you still can go right through it.
When holding a key down, you go 'in' to the ground a bit and come out when you stop.
Even if you can solve one of these I will be eternally grateful.
Thanks, Lucas

Open-source As3.0 Voxel Terrain Engine V0.1
Not long before I found Andrea "6502" Griffini's old demo of his voxel terrain (NEWVOX.C). The original C code is very clear and I decided to write a voxel terrain engine using his code.
This is the first step, I just 'translate' his C code into action script 3.0. What I want to do is add textures of terrain, sky and the background, and maybe some lighting effect as well.
But I don't have much idea how to add textures to the terrain, if you know any good tutorial on voxel rendering or know how to do that please tell me.
Improvement on this part of code would be really appreciated.



Demo:HERE
Source Code:
C(by Andrea "6502" Griffini): thanks to FengYun
AS3.0 (use arrow keys to move):HERE

Open Source As3.0 Voxel Terrain Engine V0.1
Not long before I found Andrea "6502" Griffini's old demo of his voxel terrain (NEWVOX.C). The original C code is really clear and the final work is good. So I decided to write a voxel terrain engine using his code.
This is the first step, I just 'translate' his C code into action script 3.0. What I want to do is add textures of terrain, sky and the background, and maybe some lighting effect as well.
But I don't have much idea how to add textures to the terrain, if you know any good tutorial on voxel rendering or know how to do that please tell me.
Improvement on this part of code would be really appreciated.



Demo:HERE
Source Code:
C(by Andrea "6502" Griffini): thanks to FengYun
AS3.0 (use arrow keys to move):HERE

Removing Parts Of A Shape (Destructible Terrain)
Does anyone know how to remove parts of a shape (in a movieclip) using actionscript? Something like reverse masking (where the opaque parts hide the image) or just actually modifying the shape.
I've seen it done, but I have no idea how to do it.
I've tried using masks, and I saw something about masking the mask but when using setMask() you cant mask a mask.
I'm looking for an effect much like the explosions in Serious Santa at NewGrounds
http://uploads.ungrounded.net/291000/291630_santa.swf

Open-source As3.0 Voxel Terrain Engine V0.1
Not long before I found Andrea "6502" Griffini's old demo of his voxel terrain (NEWVOX.C). The original C code is very clear and I decided to write a voxel terrain engine using his code.
This is the first step, I just 'translate' his C code into action script 3.0. What I want to do is add textures of terrain, sky and the background, and maybe some lighting effect as well.
But I don't have much idea how to add textures to the terrain, if you know any good tutorial on voxel rendering or know how to do that please tell me.
Improvement on this part of code would be really appreciated.



Demo:HERE
Source Code:
C(by Andrea "6502" Griffini): thanks to FengYun
AS3.0 (use arrow keys to move):HERE

Random Scrolling Images
How can i make 1 image appear in many different opaques and sizes slide across my movie.. Its some sort of actionscripting but i cant figure it out... Let me know


OrBiX

[CS3] Random Letter Scrolling - Please Help
Hi all,

I have been playing with a tutorial for random letter cycling ( http://www.tutorialadvisor.com/tutor...2_0-1137.html).

I have been trying to add some script so that when the letters have finished scrolling and found the word, the movie pauses briefly, then moves on to the next frame with some other animation. I think it's something to do with count equally the number of letters in the word. I am a bit of a newbie to actionscript and can't seem to get this to happen - can anyone help me please????? (see file attached)

Cheers,

Alikau

Random Scrolling Movie Clips
ok i will try to explain this the best that i can. I want to be able to have an asteriod field type effect. In other words i want to be able to have movie clips appear on the left side of the screen and scroll...random speed and y values acroos the screen til they get to the right side and then appear on the left agian. I know this can be done, if your not sure what i mean check out http://www.kirupa.com/about/linkus.htm and its basically the effect in the link too button.

ANY HELP WOULD ROCK THANKS

Keith

Trouble With Scrolling Random Images. Is It Possible?
Hey I was wondering if anyone could help me.

I’ve been busting my brain cells, reading forums and tutorials all over the place for no avail. I’ve had similar problems before but still haven’t figured it out.

Basically I was wondering how it is possible to display scrolling random images in flash. The only way I can see is by loading external jpg files or swf files in to a movie clip holder. This works fine on my machine because it loads movieclips straight away but online it is mashed as seen here.

I find it hard to believe that there is not a function that lets you display random images. What I’m trying to achieve is have a row of random images scrolling across the screen. When one image exits the screen it generate a random number, imports the corresponding swf into the holder and it joins the back of the line ready to scroll across again. Hence creating a never-ending random set of scrolling pictures.

It’s really a simple thing but I can get it to work online. Here is the source if you would like to view it working. I figure if I can load all the swf file into memory before the flash runs and the be able to reference them with out downloading delay it should work. However I’m having trouble figuring out weather this is possible or how to achieve this.

Any help would be most appreciated.

Snype.

Can Anyone Help Me? Random Letter Scrolling Issue
Hi all,

I have been playing with a tutorial for random letter cycling (2.0 as posted by Manny Dimatulac aka Thoripes - http://www.tutorialadvisor.com/tutor...2_0-1137.html).

I want to modify this movie so that it scrolls randomly through the letters, then when the word is found, the movie pauses briefly then moves to the next frame, where a new word will begin cycling ie. when the word is found, move to the next frame.

I am a bit of a newbie to actionscript and can't seem to get this to happen - can anyone help me?????

Cheers,

Alikau

Charachters Path Keeping To Curved Terrain With Maths I Dont Know?
Hello people,

I am developing a lemming’s game with the intent on changing the shape of the terrain by redrawing it with the API with a chunk missing every time a lemming blows up. What I have been stuck on for the past 2 days is the math’s need for the character keep to the contours of the dip when it passes over.

The lemmings are completely automatic in there movements of the path they take around the level.

I am using hit test to test if the lemming it touching the ground, if it isn’t, it falls until it does touch, or dies if it goes out of boundaries. This is the beginning of my problem, as when the lemming comes across a dip it starts to fall down it in increments till it gets to the bottom, then walks below the terrain line from the _y of the bottom of the ditch.

I need some code that makes sure the character never comes out of contact with the ground, to prevent it from falling (as when it does fall, it randomly goes left of right, when it touches ground again)

The code I think I’m looking for is Pythagoras?? I am no mathematician, I did this many years ago back in school but have no clue where to start now.

I think what I’m trying to ask, is how do you find out the angles of the character needed to set the rotation on every frame to stay hugging the ground? Also need to work in reverse to get back up dips?

You can have a look at what I need to do at www.iwabic.com/index2.php , this is the incomplete game (and site) just to give you a better idea of what I’m after.

Cheers to anyone who can help me with this, so I can get back on track again

(I have 'borrowed a picture from 'shawickmans' post as it describes exactly what I need to show, cheers mate ;-). )

Charachters Path Keeping To Curved Terrain With Maths I Dont
Hello people,

I am developing a lemming?s game with the intent on changing the shape of the terrain by redrawing it with the API with a chunk missing every time a lemming blows up. What I have been stuck on for the past 2 days is the math?s need for the character keep to the contours of the dip when it passes over.

The lemmings are completely automatic in there movements of the path they take around the level.

I am using hit test to test if the lemming it touching the ground, if it isn?t, it falls until it does touch, or dies if it goes out of boundaries. This is the beginning of my problem, as when the lemming comes across a dip it starts to fall down it in increments till it gets to the bottom, then walks below the terrain line from the _y of the bottom of the ditch.

I need some code that makes sure the character never comes out of contact with the ground, to prevent it from falling (as when it does fall, it randomly goes left of right, when it touches ground again)

The code I think I?m looking for is Pythagoras?? I am no mathematician, I did this many years ago back in school but have no clue where to start now.

I think what I?m trying to ask, is how do you find out the angles of the character needed to set the rotation on every frame to stay hugging the ground? Also need to work in reverse to get back up dips?

You can have a look at what I need to do at http://www.iwabic.com/index2.php , this is the incomplete game (and site) just to give you a better idea of what I?m after.

Cheers to anyone who can help me with this, so I can get back on track again :-)

Loading Random Quotes - Auto Scrolling?
Hi All,

I did a tutorial which I learn how to load random text at a textbox.

the code:


Code:
System.useCodepage = true;
//-- Random Quotes Script
ranQuote = new LoadVars();
ranQuote.onLoad = function(sucess) {
if (sucess) {
RanNum = Math.ceil(Math.random()*5);
ran = this["quote"+RanNum];
quote_txt.text = ran;
} else {
quote_txt.text = "Error Text.";
}
};
ranQuote.load("quotes.txt");
stop();
//-- Button Next
this.next_btn.onPress = function() {
gotoAndPlay(1);
};

Please anyone have a tip how can I make the text auto scroll if it is bigger than the textbox?

Thank you very much!

Virtical Scrolling Of Dynamic Random Links
hi
Does anybody know how to Scroll links from an external html page randomly and virtically on all pages of the site...?

When the links are scrolling randomly and stops on mouse over almost like on this website www.lynda.com but the links appear in an order on lynda.com if your site has many many pages and sections it will help the webmaster to display the different sections of the site to the visitors by randomly scrolling the links from and external html page... it will help in improving the site navigation very well... I hope someone will be able to answer this...

Thanks in advance...

Vinnie.

Help With Scrolling A Random Number Of Images & Links From A Database
If anyone could help, I would VERY much appreciate it.

I am a newbie when it comes to ActionScript, but I've been using Flash since Flash 2... Just a simple designer with ActionScript problems.

Anyway, I am trying to create a scrolling movie with left and right buttons to control the scrolling.

What will be scrolling is a group of images and links that are fed from a database using Swift Generator and our mySQL database.

I have figured out Swift Generator enough to understand how to feed data, but I don't really even know how to get started scrolling a random number of images.

Can anyone help?

Random Random Random Timer... Problems
Heyy guys. I know you guys know this stuff backwards & forwards so maybe you can help.

This is a 2 part problem. Part 1 is Im trying to create a timer that functions at random intervals, the function in this case is playing a MC of a car driving on a freeway in 1 to 10 second intervals to give the feeling of, well, randomness. (I've attatched the .fla file if that'll help).

So it works, but not quite as it will generate intervals only twice before it repeats the second interval over and over. So the car will 'drive' in say, 7 seconds the first time and then it will drive in 3 seconds, then again in 3, and in 3 and in 3 seconds. Ive tested it so much I know its not coinsidence.

Here's the code Im using (located in the freeway MC):

var interval:Number = random(10)+1;
function someCodeToRun() {
_root.freeway.diffcars.drive01.gotoAndPlay(2);
}
setInterval(this, "someCodeToRun", interval*1000);

Part 2 is I also wanted the cars to be different colors, which is why there is a diffcars MC with different frames of cars, but now Im not even sure I was headed in the right direction with that.

Ultimately Id love to have different colored cars driving on the freeway at different intervals. Can anyone figure this out?

PLEASE HELP - URGENT Load Random Swfs From Individual Random Sets
I have two target mcs I would like to load different random swfs into

I have eight folders (a-h), each with 12 swfs (001-012)

I need to load a random swf (001-012) from a random folder (a-h) into the "card1" mc

I have figured out how to specify which one I want:

loadMovie("a/a001.swf","card1")
stop();

however, I need it randomized....

then, I need to load another random swf into my "card2" mc (001-012) from another random folder (a-h, ...except for the folder from which the first swf was loaded)

can somebody please help??????

Random Movie Clips To Play For Random Amount Of Time
hi,
i am loading external movieclips randomly into 4 seperate emptymovies, i now need a way to get these random clips that i am loading to play for a random amount of time and then load the next clip.
i need some help with the code...

how do i get the clips to loop, then assign each a random number and have flash check if the random num is = to current frame...if it is, have that clip stop and a new one load?

i have no idea how to write the code for this
any help would be great

thanks

this is what i was given so far..but don't know what to do with it.

Code:
var rnd = Math.round(Math.random(mc._totalframes));
mc.onEnterFrame = function() {
this._currentframe >= this._parent.rnd ? unloadMovie(this) : null;
}

Script Needed: Random Picture On Random Place By Click
I have a small question about a script I'm trying to find. I don't have a lot of experience with Flash, but I have to do this thing for school for which I need this script for my website.
I need a script which does the following: When you click on a button (or just on any place if the first is not possible) with you mouse, there appears a random picture (one out of ten or something) on a random place in a field (so not the whole page).
I hope you understand what I mean. I don't know the script, I only know that it's supposed to exist :) Does anybody know this script or where I can find such a script?

Thanks for helping me!

Elfie

Simple /:xpos Scrolling, However Load External .swf When Scrolling Stops
Hi guys I need some help with a simple horizontal slider. (See attached)
Basically I have a horizontal slider with 3 buttons which make the slider go to a specific position using:

on (release) {
/:xpos = -376;
}

Now what I want to happen is that when the button is pressed I want it to load an external .swf movie (say video.swf onto level 1)

I have tried just adding using:

on (release) {
/:xpos = 0;
loadMovieNum("video.swf", 1);
}


which just loads the movie and then scrolls. However I need it to be the other way around. It scrolls to the location and then loads the movie.

I would really like it to use some type of statement telling it that if xpos = -350 then load .swf onto level 1 and if xpos has not yet reached -350 to do nothing.

However the major principal is to get the scroll and then the load, rather than the other way around.

Cheers
Dom

Help: Multipule Random Positioned Duplicate Random Movie
Does anyone know a way that i can produce a button that when rolled over will duplicate x amount of movies each with random _x and _y positions? Basically i have a movieclip that will
gotoandPlay(math.Round((math.Random()*10)+1)
which randomises that frame that is played. This instance will then do some form of tweening and then gotoandPlay(1) again. I need a script that will then keep generating more duplicate movie clips whilst a button is moused over. i tried the following

on(mouseover){
i = 0;
rand_num = math.Round((math.Random()*29)+1);
while(i<20) {
duplicateMovieClip(_root.movie, "movie"+i,i);
setProperty("movie"+i, _x, _root.movie._x+(rand_num*5);
setProperty("movie"+i, _y, _root.movie._y+(rand_num*5);
i++
}
}

where movie = movieclip name

but this seems to generate all the clips on top of each other @ different depths. I want movies that are all in different positions. Can you help?

Copyright © 2005-08 www.BigResource.com, All rights reserved