• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Help please

J

julkibr

Guest
I am trying to implement an game maker studio 2 function to game maker studio 1 ,however i am a newbie and don't know if i'm doing it right anyway. I have a problem in the code and i want to know this line is correct please help

Code:Game Maker 2:
inst.direction = (oPlayer.Image_xscale=1) ? 0 : 180

i had to make a change because i coudn't code the "?" in studio 1 .
code: if(oPlayer.image_xscale == 1) {inst.direction=180;} else (oPlayer.image_xscale==-1) {inst.direction=0;}

Remember I am a newbie,and i know something is teribly wrong hahaha. Please help ^^
 
Last edited by a moderator:
J

julkibr

Guest
what does it do in GMS 2?
Acording to the tutorial i was watching it checks if the player xscale is 1 if it's true it runs the first value:0,if it is false it runs the second value 180;

If you need more info just ask
 
then, (with assuming the xscale has only 2 values (-1 and 1))
Code:
if (oPlayer.image_xscale = 1)
 {
  inst.direction = 0;
 }
else
 {
  inst.direction = 180;
 }
 
J

julkibr

Guest
That was my code.Fortunatelly I was right,Thanks for the help. The code problem is somewhere else ^^
 
Top