Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F110592042
Mover.pde
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Apr 27, 01:28
Size
566 B
Mime Type
text/x-c++
Expires
Tue, Apr 29, 01:28 (2 d)
Engine
blob
Format
Raw Data
Handle
25809912
Attached To
rBAFOURPROJECT InfoVisuGit
Mover.pde
View Options
class Mover {
PVector location;
PVector velocity;
PVector gravity=new PVector(0,9.8);
Mover() {
location = new PVector(width/2, height/2);
velocity = new PVector(1, 1);
}
void update() {
location.add(velocity);
location.add(gravity);
}
void display() {
stroke(0);
strokeWeight(2);
fill(127);
ellipse(location.x, location.y, 48, 48);
}
void checkEdges() {
if (location.x > width || location.x < 0) {
velocity.x*=-1;
}
if (location.y > height || location.y < 0) {
velocity.y*=-1;
}
}
}
Event Timeline
Log In to Comment