Continuanodo con el juego de Mario:
Porque mi personaje si camina para la derecha al dejar de presionar el boton de caminar, mejor dicho,(le puse friccion al personaje) cuando frena el personaje para esa direccion se queda mirando para la izquierda? pero si camino para la izquierda y dejo de presionar el boton de la izquierda queda en esa direccion que es la correcta. Para la derecha tiene que quedar mirando hacia la derecha tambien. Parece un trabalenguas pero trate de explicar lo mejor posible.
Mis codigos son en el Step del personaje: (IGUAL NO SE SI ESTA BIEN PUESTO ESTO EN EL STEP)
if speed<=0 and sprite_index<>Mario_quietoR {sprite_index=Mario_quietoR}
if speed<=0 and sprite_index<>Mario_quiertoL {sprite_index=Mario_quiertoL}
el boton de caminar hacia la izquierda: (esta con velocidades de animacion segun la velocidad de Mario
friction=0
if place_free(x-hspeed,y) {if hspeed>-vel_maxima {hspeed-=acel}}
if speed<=1 and sprite_index<>Mario_andandoLLow {sprite_index=Mario_andandoLLow}
if speed>2<=5 and sprite_index<>Mario_andandoLMed {sprite_index=Mario_andandoLMed}
if speed>4 and sprite_index<>Mario_andandoLFast {sprite_index=Mario_andandoLFast}
El del boton derecho:
friction=0
if place_free(x+hspeed,y) {if hspeed<vel_maxima {hspeed+=acel}}
if speed<=1 and sprite_index<>Mario_andandoRFast {sprite_index=Mario_andandoRLow}
if speed>2<=5 and sprite_index<>Mario_andandoRMed {sprite_index=Mario_andandoRMed}
if speed>4 and sprite_index<>Mario_andandoRLow {sprite_index=Mario_andandoRFast}
ahora el release de los botonoes:
izquierda:
friction=0.2
if place_free(x+hspeed,y) {if hspeed<vel_maxima {hspeed+=acel}}
if speed<=4 and sprite_index<>Mario_andandoLLow {sprite_index=Mario_andandoLFast}
if speed>2<=5 and sprite_index<>Mario_andandoLMed {sprite_index=Mario_andandoLMed}
if speed>1 and sprite_index<>Mario_andandoLFast {sprite_index=Mario_andandoLLow}
Derecha:
friction=0.2
if place_free(x+hspeed,y) {if hspeed<vel_maxima {hspeed+=acel}}
if speed<=4 and sprite_index<>Mario_andandoRLow {sprite_index=Mario_andandoRFast}
if speed>2<=5 and sprite_index<>Mario_andandoRMed {sprite_index=Mario_andandoRMed}
if speed>1 and sprite_index<>Mario_andandoRFast {sprite_index=Mario_andandoRLow}
Les dejo el adjunto por las dudas si quieren revisarlo:
No se que hacescon tantos codigos para algo tan sensillo pero mira, estoy apurado y no he probado si sirve-
No funciona bien ;) cuando dejo de presionar los botones se queda con el sprite mario quieto, tendria que quedar en mario quieto cuando la velocidad de mario sea 0