Missile command

Developer
Size
2,502 Kb
Views
2,024

How do I make an missile command?

What is a missile command? How do you make a missile command? This script and codes were developed by Brosis Mosis on 30 January 2023, Monday.

Missile command Previews

Missile command - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Missile command </title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <!-- P5JS HAS BEEN ADDED -->
<link href="https://fonts.googleapis.com/css?family=Barrio" rel="stylesheet">
<div style="text-align: center;">
<p id="display">score: </p> <script src='https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.6/p5.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Missile command - Script Codes CSS Codes

body{ cursor: crosshair;
}
#display{ position: absolute; left:13px;
}
p{ font-family: 'Barrio', cursive; text-align: center;
}

Missile command - Script Codes JS Codes

// USING THE P5.JS LIBRARY
var birds = [];
var speedup = 1.5;
var score = 0;
var hitredturner = 100;
var hitting = false;
function Bird(){ this.x = floor(random(width)); this.y = 0; this.r = 40 this.xspeed = random(-1,1)*speedup; this.yspeed = random(1,2)*speedup; speedup += 0.03; this.deathSpeed = 1; this.display = function(){ this.x += this.xspeed; this.y += this.yspeed; fill(107, 42, 122); ellipse(this.x,this.y, this.r, this.r); } this.outofbounds = function(index){ if(this.y>height){ birds.splice(index,1); var bird = new Bird(); birds.push(bird); score -= 1; hitredturner = 0; } if(this.x<this.r/2 || this.x>width-this.r/2){ this.xspeed *= -1 } } this.shoot = function() { var disMB = dist(mouseX,mouseY,this.x+this.r/2,this.y+this.r/2) if(disMB<this.r){ hitting = true; this.r -= this.deathSpeed; } } this.shotdeath = function(index) { if(this.r<25){ birds.splice(index,1); var bird = new Bird(); birds.push(bird); score += 1; } }
}
function shooter(){ fill(20,150,120); if(hitredturner<27){ fill(255,0,0); } rect(width/2-55/2, height-60, 55, 55);
}
function lineCreator(){ strokeWeight(4); stroke(30, 115, 250); if(hitting){stroke(30, 250, 45)} line(mouseX, mouseY, width/2, height-60); strokeWeight(1); hitting = false; stroke(1);
}
function setup() { createCanvas(windowWidth-30, windowHeight-30); background(155); shooter(); var bird = new Bird(); birds.push(bird);
}
function draw(){ document.getElementById('display').innerHTML = "score: " + score; background(155); for(i = birds.length-1; i>=0; i--){ birds[i].display(); birds[i].shoot(); birds[i].shotdeath(i); birds[i].outofbounds(i); } lineCreator(); shooter(); hitredturner++; if(score<0){ //alert("you have lost") birds = []; speedup = 1.5; score = 0; hitredturner = 100; hitting = false; background(155); shooter(); var bird = new Bird(); birds.push(bird); }
}
Missile command - Script Codes
Missile command - Script Codes
Home Page Home
Developer Brosis Mosis
Username kermet24
Uploaded January 30, 2023
Rating 3
Size 2,502 Kb
Views 2,024
Do you need developer help for Missile command?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Brosis Mosis (kermet24) Script Codes
Create amazing marketing copy with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!