update defaut enemy

This commit is contained in:
Fabien Freling 2021-08-14 23:39:08 +02:00
parent 350970b695
commit d788900650

View file

@ -21,6 +21,9 @@ class Color {
static green { 6 } static green { 6 }
static green_dark { 7 } static green_dark { 7 }
static white { 12 } static white { 12 }
static grey_light { 13 }
static grey { 14 }
static grey_dark { 15 }
} }
class D { class D {
@ -133,8 +136,8 @@ class Enemy {
construct new(x, y) { construct new(x, y) {
_x = x _x = x
_y = y _y = y
_w = 8 _w = 16
_h = 8 _h = 16
_speed = 1 _speed = 1
_alive = true _alive = true
} }
@ -153,7 +156,9 @@ class Enemy {
} }
draw() { draw() {
TIC.spr(258, _x - _w / 2, _y - _h / 2, 0) var tw = _w / TileSize
var th = _h / TileSize
TIC.spr(259, _x - _w / 2, _y - _h / 2, 0, 1, 0, 0, tw, th)
} }
hit() { hit() {
@ -342,7 +347,7 @@ class World {
// //
// small stars // small stars
if (_t % 30 == 0) { if (_t % 30 == 0) {
_stars.add(Star.new(W, R.int(0,H), 1, 1, 12)) _stars.add(Star.new(W, R.int(0,H), 1, 1, Color.grey))
} }
// medium stars // medium stars
var width = 10 var width = 10
@ -387,7 +392,7 @@ class World {
if (collide(b.x, b.y, b.w, b.h, e.x, e.y, e.w, e.h)) { if (collide(b.x, b.y, b.w, b.h, e.x, e.y, e.w, e.h)) {
_player.bullets.removeAt(i) _player.bullets.removeAt(i)
e.hit() e.hit()
_vfx.add(Explosion.new(e.x + e.w / 2, e.y + e.h / 2)) _vfx.add(Explosion.new(e.x, e.y))
touched = true touched = true
break break
} }
@ -628,11 +633,15 @@ class Game is TIC{
// </TILES> // </TILES>
// <SPRITES> // <SPRITES>
// 000:00000000000000000ccc000000eccccc00eeeeee4ddddddd4cccccdd43ddddcc // 000:00000000000000000ccc000000eccccc00eeeeee4ddddddd4cccccdd433333cc
// 001:00000000000000000000000000000000ee990000ddaa9900ddaaaa90ccaaaaa9 // 001:00000000000000000000000000000000ee990000ddaa9900ddaaaa90ccaaaaa9
// 002:2000000202333320032222300320023003200230032222300233332020000002 // 002:2000000202333320032222300320023003200230032222300233332020000002
// 016:43dddddd4ddddddd4eeeeeee0ccccccc00000000000000000000000000000000 // 003:000000ff0000ffee000feeee00feeedd0feeedcc0feedc33feedc332feedc332
// 017:ddccccccddddddd0eeeeee000000000000000000000000000000000000000000 // 004:ff000000eeff0000eeeef000ddeeef00ccdeeef033cdeef0333cdeef223cdeef
// 016:43eeeeee4eeddddd4ccceeee0000eeee00000000000000000000000000000000
// 017:eeccccccdddddd00eeee00000000000000000000000000000000000000000000
// 019:feedc322feedc3330feedc330feeedcc00feeedd000feeee0000ffee000000ff
// 020:233cdeef233cdeef33cdeef0ccdeeef0ddeeef00eeeef000eeff0000ff000000
// 032:0000000099aab000899aabbc08899aab08899aab899aabbc99aab00000000000 // 032:0000000099aab000899aabbc08899aab08899aab899aabbc99aab00000000000
// </SPRITES> // </SPRITES>