Comunidad Game Maker

Ayuda => Preguntas y respuestas => Mensaje iniciado por: carry en Mayo 22, 2014, 02:53:57 AM

Título: Error de codigo
Publicado por: carry en Mayo 22, 2014, 02:53:57 AM
Amigos, estoy intentando pasar un modelo de juego de GM8 a GMS y me lanza error en la segunda linea!!!
la linea de Y+SPEED. alguien podria ayudarme!!

//My custom vertical movement variables
y+=yspeed
yspeed+=grav
//Moving left
if duck = 0
{
if keyboard_check(vk_left)
{
if phase = 2 {}else
direct = 1
hspeed-=0.09
}
//Moving right
if keyboard_check(vk_right)
{
if phase = 2 {}else
direct = 0
hspeed+=0.09
}
}
//Slowing down without an immediate stop
friction = 0.03
//Figure out if Mario should run
if keyboard_check(vk_control)
hspeedmax = 4
else
hspeedmax = 2
//Prevents Mario from going too fast
if hspeed > hspeedmax
hspeed = hspeedmax
if hspeed < hspeedmax*-1
hspeed = hspeedmax*-1
//Phase set up
if collision_rectangle(bbox_left,bbox_top+1,bbox_right,bbox_bottom+2,obj_solid,1,1)
{
if hspeed = 0
phase = 0
if hspeed > 0
phase = 1
if hspeed < 0
phase = 1
}
else
if phase < 3
phase = 2
//Sets up Mario's animations
if phase = 0
{
landed = 1
image_speed = 0
image_single = 0
}
if phase = 1
{
if fastrun = 0
image_speed = 0.15
if fastrun = 1
image_speed = 0.3
landed = 1
}
if phase = 2
{
image_speed = 0
image_single = 1
}
//Flips Mario around when he is facing another direction
if direct = 0
image_xscale = 1
if direct = 1
image_xscale = -1
//Jumping Code
if keyboard_check(vk_shift)
if jumping = 1
if yspeed < -2
yspeed-=0.5
//Floor collision
if yspeed > 0
repeat(16)
{
if collision_rectangle(bbox_left,bbox_top+4,bbox_right,bbox_bottom,obj_solid,1,1)
y-=1
}
if collision_rectangle(bbox_left,bbox_top+4,bbox_right,bbox_bottom+1,obj_solid,1,1)
{
grav = 0
yspeed = 0
}
else
grav = 0.4
//Stops Mario from falling too fast
if yspeed > 4
yspeed = 4
//Checks if a solid is above, and bumps Mario off if there is one
if yspeed < 0
if collision_rectangle(bbox_left,bbox_top-3,bbox_right,bbox_bottom-1,obj_solid,1,1)
{
sound_play(snd_bump)
yspeed = 0.5
waa = collision_rectangle(bbox_left,bbox_top-3,bbox_right,bbox_bottom-1,obj_solid,1,1)
if global.state = 0
y = waa.y+16
if global.state = 1
y = waa.y+32
//Collisions with blocks
if collision_rectangle(bbox_left,bbox_top-2,bbox_right,bbox_top-1,obj_blockparent,1,1)
{
woo = collision_rectangle(bbox_left,bbox_top-2,bbox_right,bbox_top-1,obj_blockparent,1,1)
if woo.ready = 0
and bbox_right < woo.x+31
and bbox_left > woo.x-15
{
woo.alarm [0] = 1
woo.ready = 2
}
}
}
//Stops Mario at a wall
if hspeed > 0
if collision_rectangle(bbox_right,bbox_top,bbox_right+1+hspeed,bbox_bottom,obj_solid,1,1)
hspeed = 0
if hspeed < 0
if collision_rectangle(bbox_left-1+hspeed,bbox_top,bbox_left,bbox_bottom,obj_solid,1,1)
hspeed = 0
//Checks if Mario is running at full speed
if not phase = 2
{
if hspeed > 3.99
fastrun = 1
else
if hspeed < -3.99
fastrun = 1
else
fastrun = 0
}

//Stand on floor
if collision_rectangle(bbox_left+1+hspeed,bbox_top+14,bbox_right-1,bbox_bottom,obj_solid,1,1)
{
y-=1
yspeed = 0
}
Título: Re:Error de codigo
Publicado por: TLT96 en Mayo 22, 2014, 05:29:37 AM
Debiste escribir el error de codigo.......
Lo unico que se me ocurre es que la variable yspeed no exista.....