drawScene requires full parameter to update scene

Jan 8, 2014 at 9:25 AM
Hi, I'm developing a sample game to learn SheetEngine library as a tutorial. Here is my work so far: https://github.com/isidat/Game http://www.isidat.com/Game/game.html

My problem is, drawScene function requires parameter full fed as true in order to update the scene. In documentation it says that drawScene's full parameter should be fed true only for initial draw, then, it should be fed false for frame updates. It works for this scale but I'm afraid to continue with this temporary solution. Here is my script file: https://github.com/isidat/Game/blob/master/s/game.js

At 38: this.DrawScene(true); // Initial draw
At 47: sheetengine.drawing.drawScene(true); // Frame loop, if false no motion happens

I hope somebody can answer my question, thanks.
Jan 8, 2014 at 9:53 AM
Hi,
nice demo! :)
I noticed you use 0 values for the bounding box of objects ({ w:0, h:0, relu:0, relv:0 }), that's not going to work. You need to specify a proper bounding box for your objects. w and h should be the width and height of the enclosing rectangle and relu/relv should define the relative position of the object within the bounding box.

Some explanation: when you use the drawScene(false) method only the changed parts are redrawn in the scene. Objects that did not move are not redrawn. Objects that moved or changed are redrawn. The engine will only redraw the areas corresponding to the changed objects, but for this it will need some information on how much space these objects can take up. This is why you need to specify a bounding box. You will need to specify the bounding box parameters so that the object and its shadow will surely be contained inside, even if the object is rotated or moved higher along the z-axis.

You can read some info on the topic here: https://sheetengine.codeplex.com/wikipage?title=Creating%20objects
Also here: https://www.crossyards.com/developers/defining-and-displaying-a-character
Marked as answer by isidat on 1/8/2014 at 3:40 AM
Jan 8, 2014 at 11:40 AM
Thanks for quick reply, it worked :)
sheetengine.drawObjectContour = true; also saved my life.