Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .dynamic {
- background: url(images/3.png);
- position: absolute;
- left: 0;
- top: 0;
- width: 10px;
- height: 40px;
- border: 1px dashed rgb(0, 0, 0);
- }
- function render () {
- if (pause) {
- requestAnimationFrame(render);
- return;
- }
- for (let i = 0; i < dynObj.length; i ++) {
- if ((playerLeft + 38 >= dynObj[i].x && playerLeft < dynObj[i].x) || (playerLeft <= dynObj[i] + 16)) {
- dynObj[i].div.style.borderColor = "#ff0000";
- }
- dynObj[i].x -= 4;
- dynObj[i].div.style.left = dynObj[i].x + "px";
- if (dynObj[i].x > window.innerWidth) {
- dynObj[i].div.remove();
- dynObj.splice(i,1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement