Why isn't the javascript working?


Generation Ship Webpage

I am trying to get a distribution of stars and planets without using a background image.

So I am using javascript for the shapes.

Here is the javascript code for the first blue star:


So why is this not showing up when there is a script tag in the HTML? It should be showing up at x=20, y=20 as a blue circle with a diameter of 20px.


What is the fourth 20 for?


The first 2 are for size and the second 2 are for coordinates. So this should give me a 20px circle at coordinates (20,20). However, it isn't giving me anything.


So what you're saying is that this will give an ellipse?

ellipse(30, 20, 20, 20)


Yes, that is what I was taught in javascript is that the code for an ellipse has the 2 diameters first and then the coordinates and it should give you an ellipse. Now of course this was with JS + processing JS so maybe that's why but yes that code to my knowledge should give you an ellipse and not nothing.


We don't have processing.js at our disposal in Codebits. You might need to find a sandbox that supports it, or look into creating your own local installation.

Canvas is available, but not very robust without a processing.js overlay. It takes a lot more code to do the same things.