Skip to content

Commit

Permalink
Primeros ataques y refinamiento
Browse files Browse the repository at this point in the history
  • Loading branch information
Juanter134 committed Oct 16, 2024
1 parent ceb6c3f commit e79c2eb
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 8 deletions.
Binary file added assets/ataque_prueba.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 50 additions & 6 deletions entorno.wlk
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
import wollok.game.*
import morcilla.*
import general.*

object entorno {
method limpiarEntorno() {
game.allVisuals().forEach({visible => game.removeVisual(visible)})
}
}

// =============================================== COLISIONES ===============================================
class Colisiones {
const property position

var property position
method image() = "celda_gris.png"
}

class Proyectiles inherits Colisiones {
method direccionIzquierda(velocidad) {
game.onTick(velocidad, "proyectilIzquierda", {position.x((position.x()-1))})
}

method direccionDerecha(velocidad) {
game.onTick(velocidad, "proyectilDerecha", {position.goRight(1)})
}
}

const colision0 = new Colisiones(position = new Position(x=0, y=1))


Expand All @@ -17,7 +33,7 @@ class Visual {
const property image
}

const cartelAtaque = new Visual (position = new Position(x=17, y=20), image = "celda_gris.png")
const cartelAtaque = new Visual (position = new Position(x=17, y=20), image = "proto_cartel_ataque.png")


// =============================================== BOSSFIGHTS ===============================================
Expand All @@ -26,6 +42,12 @@ class BossFight {

method iniciarPelea() {
game.boardGround("arena_de_jefe.png")
entorno.limpiarEntorno()
game.addVisual(morcilla)

jefe.posicionBatalla()
game.addVisual(jefe)

self.habilitarAtaque()
}

Expand Down Expand Up @@ -67,16 +89,38 @@ const bossFightDePrueba = new BossFight(jefe = jefeDePrueba)

// =============================================== JEFES ===============================================
class JefeInteractuable{
const property position
var property position
const property image
var property vida = 3

method posicionBatalla() {
position = game.center()
}

method disminuirVida(){
vida = (vida - 1).max(0)
}
method ataque(){

}

class JefeDePrueba inherits JefeInteractuable {
method ataque() {
const opcion = (0.randomUpTo(2)).roundUp()

if(opcion == 1)
self.ataque1()
else if(opcion == 2)
self.ataque2()

}

method ataque1() {
new
}

method ataque2() {

}
}

const jefeDePrueba = new JefeInteractuable(position = new Position(x=30, y=2), image = "celda_roja.png")
const jefeDePrueba = new JefeDePrueba (position = new Position(x=30, y=2), image = "celda_roja.png")
19 changes: 19 additions & 0 deletions general.wlk
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import wollok.game.*

class PositionMejorada inherits MutablePosition {
method goLeftMejorado(pasos, limite) {
x = (x-pasos).max(limite)
}

method goRightMejorado(pasos, limite) {
x = (x+pasos).min(limite)
}

method goUpMejorado(pasos, limite) {
y = (y+pasos).min(limite)
}

method goDownMejorado(pasos, limite) {
y = (y-pasos).max(limite)
}
}
2 changes: 0 additions & 2 deletions main.wpgm
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ program MorcillaGame {
keyboard.a().onPressDo({ morcilla.caminarIzquierda(1) })
keyboard.space().onPressDo({ morcilla.saltar(1000) })

keyboard.l().onPressDo({ game.removeVisual("stock_fondo.jpg") })

keyboard.j().onPressDo({ bossFightDePrueba.iniciarPelea() })

game.whenCollideDo(morcilla, {jefe => game.say(jefeDePrueba, "Estas colisionando")})
Expand Down
1 change: 1 addition & 0 deletions morcilla.wlk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import wollok.game.*
import general.*

object morcilla {
var property position = new MutablePosition(x=0, y=2)
Expand Down

0 comments on commit e79c2eb

Please sign in to comment.