Newgrounds.com — Everything, By Everyone.

Checking login status…

USERNAME:

PASSWORD:

Logging in…

Logged in as:
.
Logging out…
Inbox My Account Log Out


Forum Topic: Dynamic curved landscape

(126 views • 5 replies)

This topic is 1 page long.

<< < > >>
Resigned

Nuggs

Reply To Post Reply & Quote

Posted at: 12/1/07 08:58 PM

Nuggs LIGHT LEVEL 18

Sign-Up: 12/17/05

Posts: 1,201

Is there a way to make a dynamic landscape that is perfectly curved using sin waves? or do i need to create it with curve to?
either way please help.

Games|1|2|3| Movies|1|2|

BBS Signature

None

SizZlE666

Reply To Post Reply & Quote

Posted at: 12/1/07 09:33 PM

SizZlE666 LIGHT LEVEL 14

Sign-Up: 07/26/06

Posts: 702

I have 0 idea of what you're talking about.

BBS Signature

None

Nuggs

Reply To Post Reply & Quote

Posted at: 12/1/07 10:01 PM

Nuggs LIGHT LEVEL 18

Sign-Up: 12/17/05

Posts: 1,201

Usually when you use AS to draw with curve to, you get points at connecting points on the line. If you use a sine wave, the curve is smooth, and has no points.

Games|1|2|3| Movies|1|2|

BBS Signature

None

Kajenx

Reply To Post Reply & Quote

Posted at: 12/1/07 10:25 PM

Kajenx DARK LEVEL 13

Sign-Up: 12/01/06

Posts: 539

Flash doesn't have a sine wave tool. You can always line up two curves so they flow smoothly into each other, though.

BBS Signature

None

pt9-9

Reply To Post Reply & Quote

Posted at: 12/1/07 10:46 PM

pt9-9 NEUTRAL LEVEL 10

Sign-Up: 10/05/05

Posts: 746

By perfectly, do you mean vector-ly? I saw glaiel-gamer once post a application that graphed function, including trig ones.

I tried to replicate it but this is as far as I got:

var bitmap:BitmapData = new BitmapData(700, 400, true, 0xffffffff);
var image:Bitmap = new Bitmap(bitmap);
addChild(image);
image.x=0;
image.y+=200;
var pi2:Number=Math.PI*2
for(var i:int = 0; i < 700; i++) {
    bitmap.setPixel32(i,  (Math.sin(((pi2/100)*i)-(pi2/100))*100),0x88ff0000);
}

I forgot the actual specs of a trig function so you'll have to mess around for something more precise.
setpixel only allows integers, so I had to increase the amplitude.

Using the api is probably the best solution, so you can fill the segments that the pixels don't reach


None

BoMToons

Reply To Post Reply & Quote

Posted at: 12/1/07 11:09 PM

BoMToons NEUTRAL LEVEL 21

Sign-Up: 11/29/05

Posts: 1,413

You can do it with curve to if you're smart about where you place the control points. I guess it kinda depends on if you want a perfect sine wav for the landscape or some variation.

I did randomly generated terrain for P.I.C.O. 2 (and it's destroyable too!)

http://www.newgrounds.com/portal/view/37 6236


All times are Eastern Daylight Time (GMT -4) | Current Time: 11:21 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!