Advertisement
Guest User

ne udalyaetsya

a guest
Jan 28th, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. .dynamic {
  2. background: url(images/3.png);
  3. position: absolute;
  4. left: 0;
  5. top: 0;
  6. width: 10px;
  7. height: 40px;
  8. border: 1px dashed rgb(0, 0, 0);
  9. }
  10.  
  11.  
  12. function render () {
  13. if (pause) {
  14. requestAnimationFrame(render);
  15. return;
  16. }
  17.  
  18. for (let i = 0; i < dynObj.length; i ++) {
  19.  
  20.  
  21. if ((playerLeft + 38 >= dynObj[i].x && playerLeft < dynObj[i].x) || (playerLeft <= dynObj[i] + 16)) {
  22. dynObj[i].div.style.borderColor = "#ff0000";
  23. }
  24.  
  25. dynObj[i].x -= 4;
  26. dynObj[i].div.style.left = dynObj[i].x + "px";
  27.  
  28. if (dynObj[i].x > window.innerWidth) {
  29. dynObj[i].div.remove();
  30. dynObj.splice(i,1);
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement