I’m at the “Make a Video Game” project, and I’m stuck to point where I need to create a function that can remove something from an array of enemies I made. And I think I need to turn the array into a variable, but, I dunno how . So, if anyone can gimme a helping hand, I appreciate it. Here’s the code I used:
HTML Code:
<!DOCTYPE html>
<html>
<head>
<title>Blow up big bois!</title>
<link rel='stylesheet' type='text/css' href='stylesheet.css'/>
</head>
<body>
<canvas id="canvas" width="600" height="500">
</canvas>
<script type='text/javascript' src='script.js'></script>
</body>
</html>
CSS Code:
canvas {
background-color: purple;}
JavaScript Code:
var my_canvas = document.getElementById("canvas");
var context = my_canvas.getContext ("2d");
for(var i = 1;i < 6;i++){
var x = i*89;
context.fillStyle = "yellow";
context.fillRect(x,60,60,50);
}
context.fillStyle = "blue";
context.fillRect(300,250,25,25);