How to not let an object go beyond the canvas on JavaScript

前端 未结 0 1081
猫巷女王i
猫巷女王i 2021-02-19 15:40

I have a canvas on html and using JavaScript, I created an object (a square) that can be controlled using WASD keys.

var object = {
    height: 40,
    width: 40,         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题