Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

good day, i see a error, advise ? #3

Closed
FrankOcean11 opened this issue Nov 25, 2015 · 2 comments
Closed

good day, i see a error, advise ? #3

FrankOcean11 opened this issue Nov 25, 2015 · 2 comments

Comments

@FrankOcean11
Copy link

when i run this code i get this part of the code highlighted why?
Planet[] planets = new Planet[10];

de

/**

import codeanticode.planetarium.*;

// A bunch of planets
Planet[] planets = new Planet[10];
// One sun (note sun is not attracted to planets (violation of Newton's 3rd Law)
Sun s;

// An angle to rotate around the scene
float angle = 0;

void setup() {
size(800, 800, Dome.RENDERER);
smooth();
// Some random planets
for (int i = 0; i < planets.length; i++) {
planets[i] = new Planet(random(0.1, 2), random(-width/2, width/2), random(-height/2, height/2), random(-100, 100));
}
// A single sun
s = new Sun();
}

void pre() {
for (int i = 0; i < planets.length; i++) {
// Sun attracts Planets
PVector force = s.attract(planets[i]);
planets[i].applyForce(force);
// Update and draw Planets
planets[i].update();
}
}

void draw() {
background(0);

// Setup the scene
lights();

translate(width/2, height/2, 300);

rotateY(angle);

// Display the Sun
s.display();

// All the Planets
for (int i = 0; i < planets.length; i++) {
planets[i].display();
}
}

// Called after rendering all the faces, but before the dome sphere,
// so it can be used to draw stuff on the corners of the screen.
void border() {
perspective();
camera();
background(255);
fill(0);
text("FPS: " + frameRate, 20, 20);
}

void post() {
// Rotate around the scene
angle += 0.003;
}

@codeanticode
Copy link
Owner

Hi, it seems that you sketch is missing part of the code, you should have the definition of the class Planet somewhere, either down below in the main sketch code, or on a separate tab.

@FrankOcean11
Copy link
Author

thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants