ippa / jaws

Jaws - HTML5 canvas javascript 2D Game Framework
https://jawsjs.ippa.se
GNU Lesser General Public License v3.0
364 stars 75 forks source link

Adding "color" property to Sprite #72

Closed videlais closed 11 years ago

videlais commented 11 years ago

If set during instantiation, Sprite will now draw a filled rectangle defined by its rect() of property color. (Because it is using fillStyle, this can also be a linear or radial gradient too.)

Width and height, which now default to null, must also be non-null during an instantiation of Sprite when the property color is also set for anything to appear. (Will fail silently.)

Also added a single unit test for default value of property color (should be null).

ippa commented 11 years ago

The commit 2d72693 looks a bit strange.. it replaces the whole file? Makes it hard to see what's been changed.. can you fix that?

The basic idea for this is quick prototyping without making sprites/loading any assets correct?

videlais commented 11 years ago

Okay. I think I have fixed the problem. What I think happened was that, since I use NetBeans to edit JavaScript, it formatted the code for me and Git read that as changing the whole file. The newest commit should show those few changes I made now.

Yeah, for faster prototyping. It's much easier to test an idea without having to make image assets each time. Since all Sprites have a rect() anyway, it's easier to separate the art from the code by having Jaws draw filled rectangles while the art parts are being drawn and then swapping them in later.