Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mensajes - ReyHuno

1
Podrías hacerlo de otra forma aunque en la esencia es lo mismo, puedes hacerlo cómo esta en el minecraft por ejemplo, que a partir de una cierta distancia, los desactiva, tu podrías poner que si la distancia es mayor de tanto los desactive, así, aunque no funcione siempre lo de extracción, siempre y cuando no te alejes demasiado si funcionará
2
Muchas gracias por atenderme, voy a intentar arreglarlo basándome en lo que has dicho y ya comentaré más...
3
Preguntas y respuestas / Problema variable perdida de vida
Diciembre 11, 2012, 08:36:52 PM
Hola, estoy haciendo un juego tipo Zelda Link to the Past en cuanto al combate y cómo acabo de empezar a usar game maker con códigos, estoy teniedo algún problema, pero el que no consigo solucionar es el de cuando el goblin enemigo ataca al personaje. No se porque solo quita una vez la vida hasta que el personaje se aleja del ratio y luego vuelve.

La idea es que el personaje siga perdiendo vida hasta que no salga del área de ataque con un retardo de unos 30 frames por segundo...

El área del código que interesa es este:

//Si marca como objetivo al Héroe
if (distance_to_object(obj_hero)>3 and distance_to_object(obj_hero)-3<distance_to_object(obj_castillo) and not collision_point(x,y,obj_goblin1,1,1)){
    mp_potential_step_object(obj_hero.x,obj_hero.y,3,obj_pared)
   
    //Si esta más lejos en direccion X que en Y
    if (distance_to_point (obj_hero.x,y)>(distance_to_point (x,obj_hero.y)) and obj_hero.x > self.x) {
        sprite_index = spr_goblin1_l2;
        image_xscale = -1;
        //Si se encuentra muy cerca, Atacar
        if (distance_to_object(obj_hero)<=6+5) {
            if (collision_rectangle (self.x+5,self.y,self.x+32,self.y-32,obj_hero,0,1)){
                image_speed = 0.2;
                sprite_index = spr_goblin1_la;
                image_xscale = -1;
                global.vida -= random_range (1,3);
            }
        }
    }
    if (distance_to_point (obj_hero.x,y)>(distance_to_point (x,obj_hero.y)) and obj_hero.x < self.x) {
        sprite_index = spr_goblin1_l2;
        image_xscale = 1;
    }
    //Si esta más lejos en direccion Y que en X
    if (distance_to_point (x,obj_hero.y)>(distance_to_point (obj_hero.x,y)) and obj_hero.y > self.y) {
        sprite_index = spr_goblin1_d2;
        image_xscale = 1;
        //Si se encuentra muy cerca, Atacar
        if (distance_to_object(obj_hero)<=6) {
            if (collision_rectangle (self.x-15,self.y,self.x+16,self.y+32,obj_hero,0,1)){
                image_speed = 0.2;
                sprite_index = spr_goblin1_da;
                image_xscale = 1;
                global.vida -= random_range(1,3);
                }
            }
        }
}
    if (distance_to_point (x,obj_hero.y)>(distance_to_point (obj_hero.x,y)) and obj_hero.y < self.y) {
        sprite_index = spr_goblin1_u2;
        image_xscale = 1;
        //Si se encuentra muy cerca, Atacar
        if (distance_to_object(obj_hero)<=6) {
            if (collision_rectangle (self.x-15,self.y+22,self.x+16,self.y+7+32,obj_hero,0,1)){
                image_speed = 0.2
                sprite_index = spr_goblin1_ua;
                image_xscale = 1;
                global.vida -= random_range(1,3);
            }
        }
    }


A parte de eso otro problema es que la vida que quite vaya en valores enteros, pero eso es secundario...

Muchas gracias de antemano por todo, espero haberme explicado bien
4
Muchisimas gracias, conseguí hacer que funcionara, me sirvió muchísimo, cuando lleve suficiente ya mostraré un poco, y si, bien podía haberlo hecho entro tema, lo siento si lo hice mal...
5
Muchisimas gracias a los dos, me sirvió, pero ahora no se porque no lanza bolas, debería lanzar hacia el protagonista
6
Hola, siento mucho hacer un pregunta tan estúpida, pero el caso es que me ha requerido mucho tiempo y al final no he conseguido gran cosa...

Estoy haciendo un juego de plataformas, y mi intención es que los enemigos miren hacia nuestro protagonista, estos enemigos se mueven y demás, lo que ocurre es que yo he puesto en Step, si x sobre nuestro protagonista es mayor, mirar a la derecha, y lo mismo pero al reves para el otro lado, lo que ocurre es que solo pone el sprite inicial, como si lo estuviera ejecutando continuamente, por lo que probé con hacer una Time Line y poner en el Step 0 eso y repetirlo en el step 1 dado que los enemigos estan formados por 4 sprites y puse para que fueran a 0.25 cada 1, luego puse la time line en el evento create del enemigo y con Loop (que se repita), sin emabargo, luego, a la hora de probar el juego ocurre esto:

El sprite del enemigo se mueve pero no varia en si me encuentro a la izquierda o a la derecha de este...

Muchas gracias de antemano y espero haberme explicado bien
7
Preguntas y respuestas / Re:Problema con los solidos
Marzo 01, 2012, 08:08:17 PM
Pff...

Lo siento, soy un negado, y lo cierto es que funciona perfectamente en el otro, pero no entendí muy bien como adaptarlo al mio, mira la información de mi personaje es esta:

Information about object: obj_kirby

Sprite: spr_kirby_der
Solid: false
Visible: true
Depth: 0
Persistent: true
Parent: <no parent>
Mask: <same as sprite>

Create Event:
set variable NextLvl to 0
set variable Cantidad to 0
set variable Dire to 1
set variable Moverse to 1
set variable Absorver to 0
set variable Fuego to 0
set variable Hielo to 0
set the sprite to spr_kirby_der with subimage 3 and speed 0.25

Step Event:
if relative position (0,1) is collision free for Only solid objects
      set the gravity to 1 in direction 270
else
      set the gravity to 0 in direction 270
if vspeed is larger than 18
      set the vertical speed to 18

Collision Event with object obj_e_fuego:
if expression vspeed > 0 && y < other.y+64 is true
      if relative position (0,1) gives a collision with Only solid objects
            set the vertical speed to -8
      for other object: destroy the instance
else
      set the number of lives relative to -1
      jump to the start position
      set variable Fuego to 0
      set variable Hielo to 0

Collision Event with object obj_suelo_inicial:
move in direction direction at most 12 till a contact with solid objects
set the vertical speed to 0

Collision Event with object obj_bola_fuego_en:
for other object: destroy the instance
if Fuego is equal to 0
      set the number of lives relative to -1
      jump to the start position
if Fuego is equal to 1
      exit this event

Collision Event with object obj_goto_next_lvl:
if next room exists
      go to next room with transition effect <no effect>

Collision Event with object obj_arenas_movedizas:
if vspeed is larger than 0
      move in direction direction at most 12 till a contact with all objects
      set the vertical speed to 0
if vspeed is equal to 0
      move in direction direction at most 12 till a contact with all objects
      set the vertical speed to 0
if vspeed is smaller than 0
      exit this event

Collision Event with object obj_suelo_salto:
if vspeed is larger than 0
      move in direction direction at most 12 till a contact with all objects
      set the vertical speed to 0
if vspeed is smaller than 0

Collision Event with object obj_e_hielo:
if expression vspeed > 0 && y < other.y+64 is true
      if relative position (0,1) gives a collision with Only solid objects
            set the vertical speed to -8
      for other object: destroy the instance
else
      set the number of lives relative to -1
      jump to the start position
      set variable Fuego to 0
      set variable Hielo to 0

Collision Event with object obj_bola_hielo_en:
for other object: destroy the instance
if Hielo is equal to 0
      set the number of lives relative to -1
      jump to the start position
if Hielo is equal to 1
      exit this event

Keyboard Event for <Left> Key:
if Moverse is equal to 1
      COMMENT: Si esta permitido Moverse
      if relative position (-6,0) is collision free for Only solid objects
            jump relative to position (-6,0)
      set variable Direccion to -1
if Moverse is equal to 0
      COMMENT: Si no esta permitido Moverse
      exit this event

Keyboard Event for <Up> Key:
if Moverse is equal to 1
      if relative position (0,1) gives a collision with Only solid objects
            set the vertical speed to -16
if Moverse is equal to 0
      COMMENT: Si no esta permitido Moverse
      scale the sprite with 1 in the xdir, 1 in the ydir, rotate over 0, and no mirroring

Keyboard Event for <Right> Key:
if Moverse is equal to 1
      if relative position (6,0) is collision free for Only solid objects
            jump relative to position (6,0)
if Moverse is equal to 0
      COMMENT: Si no esta permitido Moverse
      exit this event

Keyboard Event for X-key Key:
if Fuego is equal to 1
      if Cantidad is equal to 0
            set time line tim_lanzamiento at position 0, Start Immediately and Don't Loop
if Hielo is equal to 1
      if Cantidad is equal to 0
            set time line tim_lanzamiento at position 0, Start Immediately and Don't Loop

Key Press Event for <Left> Key:
if Fuego is equal to 0
      set the sprite to spr_kirby_andar_izq with subimage 3 and speed 0.25
if Hielo is equal to 0
      set the sprite to spr_kirby_andar_izq with subimage 3 and speed 0.25
if Fuego is equal to 1
      blend the sprite with color 16744703 and alpha value 1
if Hielo is equal to 1
      blend the sprite with color 16711680 and alpha value 1
set variable Dire to -1

Key Press Event for <Right> Key:
if Fuego is equal to 0
      set the sprite to spr_kirby_andar_der with subimage 3 and speed 0.25
if Hielo is equal to 0
      set the sprite to spr_kirby_andar_der with subimage 3 and speed 0.25
if Fuego is equal to 1
      blend the sprite with color 16744703 and alpha value 1
if Hielo is equal to 1
      blend the sprite with color 16711680 and alpha value 1
set variable Dire to 1

Key Press Event for Z-key Key:
if Fuego is equal to 0
      if Absorver is equal to 0
            if relative position (0,1) gives a collision with Only solid objects
                  set time line tim_absorver at position 0, Start Immediately and Don't Loop
      if Fuego is equal to 1
            if Absorver is equal to 0
                  if relative position (0,1) gives a collision with Only solid objects
                        set time line tim_absorver at position 0, Start Immediately and Don't Loop
            else
                  exit this event
      if Fuego is equal to 1
            set variable Fuego to 0
      if Hielo is equal to 1
            set variable Hielo to 0

Key Release Event for <Left> Key:
if Fuego is equal to 0
      set the sprite to spr_kirby_izq with subimage 3 and speed 0.25
if Hielo is equal to 0
      set the sprite to spr_kirby_izq with subimage 3 and speed 0.25
if Fuego is equal to 1
      blend the sprite with color 16744703 and alpha value 1
if Hielo is equal to 1
      blend the sprite with color 16711680 and alpha value 1

Key Release Event for <Right> Key:
if Fuego is equal to 0
      set the sprite to spr_kirby_der with subimage 3 and speed 0.25
if Hielo is equal to 1
      set the sprite to spr_kirby_der with subimage 3 and speed 0.25
if Fuego is equal to 1
      blend the sprite with color 16744703 and alpha value 1
if Hielo is equal to 1
      blend the sprite with color 16711680 and alpha value 1


La gran mayoría no tiene nada que ver, pero es simplemente porque no se que puedo hacer, muchas gracias de antemano...
8
Preguntas y respuestas / Problema con los solidos
Febrero 29, 2012, 11:09:40 PM
Hola, tengo un problema, estoy haciendo un juego de plataformas y el salto funciona bien, pero quiero que haya un tipo de suelo al que desde abajo puedas saltarlo y desde arriba sea solido...

De momento lo que yo he intentado ha sido esto:



Muchas gracias de antemano
9
Preguntas y respuestas / Re:Duda lanzamiento de objetos
Febrero 26, 2012, 11:14:36 AM
Vale, lo siento mira, esto es lo que conseguí hacer...
Use variables, no los comandos e hice lo siguiente:

variable x
value mi_personaje.x
larger than

y luego el lanzar bola a la izquierda, despues uso lo mismo pero con smaller y lanzar a la derecha

Tengo eso y de momento funciona bien
10
Preguntas y respuestas / Duda lanzamiento de objetos
Febrero 25, 2012, 09:25:07 PM
Hola, muy buenas, he empezado a diseñar un juego y tengo el problema de que quiero que si el personaje esta a la izquierda del enemigo, el enemigo lance bolas en su dirección, pero de dos maneras, a ser posible por separado...

Quiero que en la primera forma solo lance bolas en la variable x, de esta forma sería facil esquivarlo... y la segunda en la variable x e y...

Muchas gracias de antemano, espero una respuesta y por si quedan dudas, uso Game Maker  :GM8:.0
11
Mira, puesto que usas el sistema de iconos, si para mover al personaje usas el evento "Move Fixed" (Las flechas rojas en todas las direcciones), el personaje no podr? moverse a trav?s de cualquier objeto solido o no, esto no se si es por el hecho de que este la acci?n collision, pero yo ya lo intent? en uno de mis primeros juegos y fue por eso, lo que hice fue cambiar la forma del movimiento del personaje.

Espero que te sirva, mucha suerte
12
A vale, lo que hace ese codigo es que se cambie en diagonal...

Uf pues no tengo en diagonal...

Bueno muchas gracias, eso sera perfecto, gracias por el tiempo dedicado.

Ya os ense?are el juego cuando este acabado o quede poco...
13
Eso supuse, pero como lo hago entonces...
14
Muchas gracias, me funciona el c?digo, pero no consigo que me cambia a los gr?ficos de izquierda y derecha, el c?digo ahora es:

[gml]if obj_enemigo.x > obj_jugador.x
{
sprite_index=spr_enemigo_izq
}
else
{
sprite_index=spr_enemigo_der
}

if obj_enemigo.y > obj_jugador.y
{
sprite_index=spr_enemigo_up
}
else
{
sprite_index=spr_enemigo_dw
}[/gml]
15
Haber, que me entere...

Mis gr?ficos son:

spr_personaje_up Andando para arriba
spr_personaje_dw Andando para abajo
spr_personaje_izq Andando para la izquierda
spr_personaje_der Andando para la derecha

Me puedes poner el c?digo directamente con estos gr?ficos...

Yo lo he hecho as?, pero se que esta mal...
[gml]if obj_enemigo.x > obj_jugador.x
{
sprite_assign(0,spr_enemigo_izq)
}
else
{
sprite_assign(0,spr_enemigo_der)
}

if obj_enemigo.y > obj_jugador.y
{
sprite_assign(0,spr_enemigo_up)
}
else
{
sprite_assign(0,spr_enemigo_dw)
}[/gml]