Hope I'm not spamming. I made a grid-based cursor of sorts, but if I'm moving it my FPS slowly drops:
Rectangles do get deleted and it all works fine visually. FPS is the only problem.
The whole thing is in a loop and It won't draw rectangles with the same coordinates over and over again.
self(this)[X] is a variable
Code:
//deleting the old cursor bitmap
window.myCursorList[0].bitmap.clearRect(self(this)["xMathCursor"], self(this)["yMathCursor"], self(this)["pixel size"], self(this)["pixel size"])
window.myCursorList.splice(0)
window.myCursorList[0].bitmap.clear()
//drawing a new one
var bitmap = new Bitmap(816, 624);
bitmap.fillRect(self(this)["xMath"], self(this)["yMath"], self(this)["pixel size"], self(this)["pixel size"], self(this)["color"])
var cursor = new Sprite(bitmap);
SceneManager._scene.addChildAt(cursor, 3)
window.myCursorList.push(cursor)
//save coordinates of the old one to delete it later
self(this)["xMathCursor"] = self(this)["xMath"]
self(this)["yMathCursor"] = self(this)["yMath"]
Rectangles do get deleted and it all works fine visually. FPS is the only problem.
The whole thing is in a loop and It won't draw rectangles with the same coordinates over and over again.
self(this)[X] is a variable