Fixing blink on sprites (#1047)
This commit is contained in:
parent
b03c984c38
commit
68361499a2
@ -537,7 +537,7 @@ namespace game {
|
|||||||
*/
|
*/
|
||||||
//% parts="ledmatrix"
|
//% parts="ledmatrix"
|
||||||
public setDirection(degrees: number): void {
|
public setDirection(degrees: number): void {
|
||||||
this._dir = ((degrees / 45) % 8) * 45;
|
this._dir = (Math.floor(degrees / 45) % 8) * 45;
|
||||||
if (this._dir <= -180) {
|
if (this._dir <= -180) {
|
||||||
this._dir = this._dir + 360;
|
this._dir = this._dir + 360;
|
||||||
} else if (this._dir > 180) {
|
} else if (this._dir > 180) {
|
||||||
@ -717,7 +717,6 @@ namespace game {
|
|||||||
* @param this TODO
|
* @param this TODO
|
||||||
*/
|
*/
|
||||||
public blink(): number {
|
public blink(): number {
|
||||||
let r: number;
|
|
||||||
return this._blink;
|
return this._blink;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -728,7 +727,7 @@ namespace game {
|
|||||||
if (ps._brightness > 0) {
|
if (ps._brightness > 0) {
|
||||||
let r = 0;
|
let r = 0;
|
||||||
if (ps._blink > 0) {
|
if (ps._blink > 0) {
|
||||||
r = (now / ps._blink) % 2;
|
r = Math.floor(now / ps._blink) % 2;
|
||||||
}
|
}
|
||||||
if (r == 0) {
|
if (r == 0) {
|
||||||
_img.setPixelBrightness(ps._x, ps._y, _img.pixelBrightness(ps._x, ps._y) + ps._brightness);
|
_img.setPixelBrightness(ps._x, ps._y, _img.pixelBrightness(ps._x, ps._y) + ps._brightness);
|
||||||
|
Loading…
Reference in New Issue
Block a user