Missile command
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 - 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); }
}
Developer | Brosis Mosis |
Username | kermet24 |
Uploaded | January 30, 2023 |
Rating | 3 |
Size | 2,502 Kb |
Views | 2,024 |
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!
Name | Size |
Snake | 12,607 Kb |
The Indian in the cupboard | 6,375 Kb |
Simon | 4,847 Kb |
Chicken Neon | 3,465 Kb |
Brosis Mosis Portfilo | 2,444 Kb |
Super Luigi Dungeon Crawler-Alpha Build | 15,482 Kb |
Tic Tac Toe | 4,302 Kb |
Chicken | 2,164 Kb |
Freee Code Camp Leader Board | 1,753 Kb |
Infanite runner | 4,077 Kb |
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!
Name | Username | Size |
Hamburger Menu Animation | Salmanraza | 2,580 Kb |
Simple CSS loader. | Cabrera | 2,574 Kb |
JS Beispiel getElementsByClassName 3 | HSZG-Frontend-Kurs | 1,988 Kb |
A Pen by Brendan Skousen | Bskousen | 2,954 Kb |
Algorithm practice | Abensur | 5,620 Kb |
Brian The CSS Bee | Jonitrythall | 3,922 Kb |
Wrap_Test | Mscfourn | 7,503 Kb |
A Pen by Malith Hettiarachchi | MalZiiirA | 5,531 Kb |
Konami Code Easter Egg | Teolitto | 3,051 Kb |
Pure CSS Animated Photo Stack | Depthdev | 2,486 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!