Estoy trabajando en un juego de Mario, con power ups personalizados.
Entre ellos, un power up de ping?ino. Debe nadar como Mario en traje de rana, aventar bolitas de nieve, y aventarse para deslizarse de panza. XD
Cuando se desliza y choca contra un solido, debe invertirse el sprite, pero no se como hacerlo.
Alguien puede corregir esta escritura?
Esto viene en step.
[gml]x = round(x*100)/100
if instance_exists(obj_mario)
{
obj_mario.x = x
obj_mario.hspeed = hspeed
obj_mario.visible = 0
y = obj_mario.y
if yayaya = 1
obj_mario.invincible = 1
else
if obj_mario.invincible = 0
{
yayaya = 1
obj_mario.invincible = 1
}
}
else
instance_destroy()
if global.state != 14
instance_destroy()
if collision_rectangle(bbox_left,bbox_bottom,bbox_right,bbox_bottom+3,obj_swim,1,1)
instance_destroy()
if not keyboard_check(vk_down)
instance_destroy()
if hspeed < 0.05
and hspeed > -0.05
and not collision_rectangle(bbox_left,bbox_bottom,bbox_right,bbox_bottom+3,obj_slopeparent,1,1)
instance_destroy()
if collision_rectangle(bbox_left,bbox_bottom,bbox_right,bbox_bottom+3,obj_slope_r,1,1)
hspeed -= 0.1
if collision_rectangle(bbox_left,bbox_bottom,bbox_right,bbox_bottom+3,obj_slope_l,1,1)
hspeed += 0.1
if collision_rectangle(bbox_left,bbox_bottom,bbox_right,bbox_bottom+3,obj_slope_sr,1,1)
hspeed -= 0.1
if collision_rectangle(bbox_left,bbox_bottom,bbox_right,bbox_bottom+3,obj_slope_sl,1,1)
hspeed += 0.1
if hspeed > 3
hspeed = 3
if hspeed < -3
hspeed = -3
if collision_rectangle(bbox_left,bbox_bottom,bbox_right,bbox_bottom+3,obj_solidtop,1,1)
and not collision_rectangle(bbox_left,bbox_bottom,bbox_right,bbox_bottom+3,obj_slopeparent,1,1)
friction = 0.02
else
friction = 0
if hspeed > 0
and collision_rectangle(bbox_right+hspeed,y+20,bbox_right+hspeed,y+29,obj_solid,1,1)
{
sound_play(snd_bump)
instance_create(x-8,y+16,obj_blockbumper)
hspeed = -hspeed
}
if hspeed < 0
and collision_rectangle(bbox_left+hspeed,y+20,bbox_left+hspeed,y+29,obj_solid,1,1)
{
sound_play(snd_bump)
instance_create(x-8,y+16,obj_blockbumper)
hspeed = -hspeed
}
image_speed = 0[/gml]
Aunque creo que no debi poner todo, pero en algun lugar debe estar el problema.
Si necesitan explicaciones, yo puedo aclararles.
Yo utilizaria la funcion place_meeting()
En STEP:
if place_meeting(x+1,y,pared) {image_xscale=-1}
if place_meeting(x11,y,pared) {image_xscale=1}