Example #1
0
func (m *MonsterGhost) Blit(surface *sdl.Surface) {
	m.H = float64(IM.Monsters[0][0].H)
	m.W = float64(IM.Monsters[0][0].W)
	if difftime(m.GotHit) > 0 {
		surface.Blit(&sdl.Rect{int16(m.X - m.W/2), int16(m.Y - m.H/2), 0, 0}, IM.Monsters[0][0], nil)
	}
}
Example #2
0
func (r *Robot) Blit(surface *sdl.Surface) {
	img := IM.Monsters[2][r.Direction+r.IsBoss]
	r.H = float64(img.H)
	r.W = float64(img.W)
	if difftime(r.GotHit) > 0 {
		surface.Blit(&sdl.Rect{int16(r.X - r.W/2), int16(r.Y - r.H/2), 0, 0}, img, nil)
	}
}
Example #3
0
func (d *Malboro) Blit(surface *sdl.Surface) {
	img := IM.Monsters[3][0]
	d.H = float64(img.H)
	d.W = float64(img.W)

	if difftime(d.GotHit) > 0 {
		surface.Blit(&sdl.Rect{int16(d.X - d.W/2), int16(d.Y - d.H/2), 0, 0}, img, nil)
	}
}
Example #4
0
func (t *Teleport) Blit(surface *sdl.Surface) {
	if t.O == TELE_HORIZONTAL {
		for x := 0; x < t.S*2; x++ {
			surface.Blit(&sdl.Rect{int16(t.X-t.W/2) + int16(20*x), int16(t.Y - t.H/2), 0, 0}, t.Image, nil)
		}
	} else {
		for x := 0; x < t.S*2; x++ {
			surface.Blit(&sdl.Rect{int16(t.X - t.W/2), int16(t.Y-t.H/2) + int16(20*x), 0, 0}, t.Image, nil)
		}
	}
}
Example #5
0
func (s *Spoils) Blit(surface *sdl.Surface) {
	switch s.Type {
	case SP_HEART:
		surface.Blit(&sdl.Rect{int16(s.X - s.W/2), int16(s.Y - s.H/2), 0, 0}, IM.Misc[0], nil)
	case SP_UPGRADE:
		surface.FillRect(&sdl.Rect{int16(s.X - s.W/2), int16(s.Y - s.H/2), 10, 10}, uint32(s.Frame))
		s.Frame = s.Frame*s.Frame + 1
		if s.Frame > 0xFFFFFF {
			s.Frame = 0
		}
	}
}
Example #6
0
func BlitHeartsAndTimer(surface *sdl.Surface, antal int, t GameTime) {
	x := 18*BOXSIZE + 10
	y := 5
	for i := 0; i < antal; i++ {
		surface.Blit(&sdl.Rect{int16(x), int16(i*30 + y), 0, 0}, IM.Misc[0], nil)
	}

	max := t.End - t.Start
	nu := t.End - now()
	if nu <= 0 {
		return
	}
	surface.FillRect(&sdl.Rect{int16(x + BOXSIZE), 5 + BOXSIZE, 15, uint16((200 * nu) / max)}, 0xFFFFFF)
}
Example #7
0
func (d *Deathshell) Blit(surface *sdl.Surface) {
	var img *sdl.Surface
	if d.IsBoss == DS_ISBOSS {
		img = IM.Monsters[1][1+d.Direction]
	} else {
		img = IM.Monsters[1][0]
	}

	d.H = float64(img.H)
	d.W = float64(img.W)

	if difftime(d.GotHit) > 0 {
		surface.Blit(&sdl.Rect{int16(d.X - d.W/2), int16(d.Y - d.H/2), 0, 0}, img, nil)
	}
}
Example #8
0
func (l *Level) Blit(surface *sdl.Surface) {
	surface.Blit(&sdl.Rect{0, 0, 0, 0}, l.Surface, nil)
}
Example #9
0
func (l *ScreenObject) Blit(surface *sdl.Surface) {
	if l == selected {
		surface.FillRect(&sdl.Rect{int16(l.X - l.W/2), int16(l.Y - l.H/2), uint16(l.W), uint16(l.H)}, 0xFFFFFF)
	}
	surface.Blit(&sdl.Rect{int16(l.X - l.W/2), int16(l.Y - l.H/2), 0, 0}, l.image(), nil)
}
Example #10
0
func (l *Button) Blit(surface *sdl.Surface) {
	surface.Blit(&sdl.Rect{int16(l.X - l.W/2), int16(l.Y - l.H/2), 0, 0}, l.Image, nil)
}
Example #11
0
func (s *Spike) Blit(surface *sdl.Surface) {
	surface.Blit(&sdl.Rect{int16(s.X - s.W/2), int16(s.Y - s.H/2), 0, 0}, IM.Shots[2], nil)
}
Example #12
0
func (b *Player) Blit(surface *sdl.Surface) {
	surface.Blit(&sdl.Rect{int16(b.X - b.W/2), int16(b.Y - b.H/2), 0, 0}, b.Animate(), nil)

	surface.Blit(&sdl.Rect{19*BOXSIZE + 10, 10, 0, 0}, IM.Shots[b.Lvl], nil)
}
Example #13
0
func (l *EnemyLaser) Blit(surface *sdl.Surface) {
	l.H = float64(IM.Shots[0].H)
	l.W = float64(IM.Shots[0].W)
	surface.Blit(&sdl.Rect{int16(l.X - l.W/2), int16(l.Y - l.H/2), 0, 0}, IM.Shots[0], nil)
}