GML stands for Game Maker Language
Here is a working GML of if relative:
Create Event
- Code: Select all
hp = 124; //variable hp is 124
hp_divided_by = 1; //will be used to divide hp
hp_minus = 0; //will be used to reduce hp
hp_plus = 0; //will be used to increase hp
hp_times_by = 1; //will be used to multiply hp
Step Event
- Code: Select all
if (hp_times_by <> 0) //if hp_times_by more/less than 1
{
hp *= hp /= hp_times_by; //hp times by hp_times_by
hp_times_by = 1; //hp_times_by equals 1
}
if (hp_minus <> 0) //if hp_minus is less or more than 0
{
hp -= hp_minus; //hp reduced by hp_minus
hp_minus = 0; //hp_minus equals to 0
}
if (hp_plus <> 0) //if hp_plus is more or less than 0
{
hp += hp_plus; //hp gets increased hp_plus
hp_plus = 0; //hp_plus equals to 0
}
if (hp_divided_by <> 1) //self explanitory
{
hp /= hp_divided_by; //hp divided by hp_divided_by
hp_divided_by = 1; //hp_divided_by equals to 1
}
if (hp_divided_by = 12) //if hp_divided_by equals 12
{
x += 13; //go right by thirteen pixels
}
if (hp_minus = 12) //if hp_minus equals 12
{
y += 13; //go down by 13 pixels
}
if (hp_plus = 12) /if hp_plus equals 12
{
y -= 13; //go up by thirteen pixels
}
if (hp_times_by = 12) //if hp_times_by equals 12
{
x -= 13; //go left by 13 pixels
}
if (keyboard_check_pressed(ord("T))) //if T is pressed
{
hp_times_by = 12; //hp_times_by equals to 12
}
if (keyboard_check(ord("P"))) //if P is pressed
{
hp_plus = 12; //hp_plus equals to 12
}
if (keyboard_check_pressed(ord("M")))//if M is pressed
{
hp_minus = 12; //hp_minus equals to 12
}
if (keyboard_check_pressed(ord("D"))) //if D is pressed
{
hp_divided_by = 12; //hp_divided_by equals to 12
}
How in Game Editor do I properly do up above coding please? Thank you.