Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
pwnmonkey
pwnmonkey's Profile
1
Posts
0
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
2D Terrain Deformation
[2 Replies]
09-Aug-2010 04:00 PM
Forum:
Share your Work
//2010 Devan Buggay
float[][] ground= new float[250][3];
void setup(){
frameRate(60);
size(500,500);
strokeWeight(2);
}
void draw(){
background(255);
for(int i=1;i<(width/2);i++){
stroke(100,50,50);
line(i*2,ground[i][0]+300,i*2,height);
line(((i-1)*2),ground[i-1][0]+300,i*2,ground[i][0]+300);
}
println(frameRate);
}
void deform(float x){
for(int i=1;i<(width/2);i++){
int r=abs(int(x)-i);
ground[i][0]+=500/(500+exp(r));
}
}
void mousePressed(){
deform(mouseX/2);
}
Hey guys I wrote a 2d Terrain program, If anyone wants to use it or have any suggestions on how to make it better that would be much appreciated. I was thinking about making a tanks sort of game with it.
«Prev
Next »
Moderate user : pwnmonkey
Forum