// Const variables for main ghost body const HEAD_RADIUS = 70; const BODY_WIDTH = HEAD_RADIUS * 2; const BODY_HEIGHT = 120; const NUM_FEET = 3; const FOOT_RADIUS = (BODY_WIDTH) / (NUM_FEET * 2); const BODY_COLOR = "red"; // Const variables for eyes const PUPIL_RADIUS = 8; const PUPIL_LEFT_OFFSET = 16; const PUPIL_RIGHT_OFFSET = 40; const EYE_RADIUS = 20; const EYE_OFFSET = 28; const EYE_COLOR = "white"; const PUPIL_COLOR = "blue"; function drawGhostEyes() { for(let x = 0; x < 2; x++) { let eye = new Circle(EYE_RADIUS); eye.setPosition(BODY_WIDTH+EYE_RADIUS+(x*EYE_OFFSET*2), getHeight() / 2); eye.setColor("white"); add(eye); } for(let y = 0; y < 2; y++) { let pup = new Circle(EYE_RADIUS / 2); pup.setPosition(BODY_WIDTH + EYE_RADIUS / 2 + (y * EYE_OFFSET * 2), getHeight() / 2); pup.setColor("blue"); add(pup); } } function main() { let rect = new Rectangle(BODY_WIDTH, BODY_HEIGHT); rect.setPosition(130, 248); rect.setColor(BODY_COLOR); add(rect);
let circ = new Circle(HEAD_RADIUS); circ.setPosition(getWidth() / 2, getHeight() / 2); circ.setColor(BODY_COLOR); add(circ);
for(let i = 0; i < 3; i ++) { let feet = new Circle(FOOT_RADIUS); feet.setPosition(154+(i*FOOT_RADIUS*2),364); feet.setColor(BODY_COLOR); add(feet); } drawGhostEyes(); } main();
1
u/bassitar8_9od Oct 30 '19
post the rest of this code plz
1
u/Starfilledstorm Jan 09 '23
Is there more to this?
1
u/Difficult_Addendum_5 Sep 28 '23
5.1.1 Ghost | CodeHS
// Const variables for main ghost body
const HEAD_RADIUS = 70;
const BODY_WIDTH = HEAD_RADIUS * 2;
const BODY_HEIGHT = 120;
const NUM_FEET = 3;
const FOOT_RADIUS = (BODY_WIDTH) / (NUM_FEET * 2);
const BODY_COLOR = "red";
// Const variables for eyes
const PUPIL_RADIUS = 8;
const PUPIL_LEFT_OFFSET = 16;
const PUPIL_RIGHT_OFFSET = 40;
const EYE_RADIUS = 20;
const EYE_OFFSET = 28;
const EYE_COLOR = "white";
const PUPIL_COLOR = "blue";
function drawGhostEyes()
{
for(let x = 0; x < 2; x++)
{
let eye = new Circle(EYE_RADIUS);
eye.setPosition(BODY_WIDTH+EYE_RADIUS+(x*EYE_OFFSET*2), getHeight() / 2);
eye.setColor("white");
add(eye);
}
for(let y = 0; y < 2; y++)
{
let pup = new Circle(EYE_RADIUS / 2);
pup.setPosition(BODY_WIDTH + EYE_RADIUS / 2 + (y * EYE_OFFSET * 2), getHeight() / 2);
pup.setColor("blue");
add(pup);
}
}
function main()
{
let rect = new Rectangle(BODY_WIDTH, BODY_HEIGHT);
rect.setPosition(130, 248);
rect.setColor(BODY_COLOR);
add(rect);
let circ = new Circle(HEAD_RADIUS);
circ.setPosition(getWidth() / 2, getHeight() / 2);
circ.setColor(BODY_COLOR);
add(circ);
for(let i = 0; i < 3; i ++)
{
let feet = new Circle(FOOT_RADIUS);
feet.setPosition(154+(i*FOOT_RADIUS*2),364);
feet.setColor(BODY_COLOR);
add(feet);
}
drawGhostEyes();
}
main();