#### GamingLover

##### New member

Here is a permitted to copy and use if relative example for GML

Code:

```
Create Event
hp = 12; //variable hp is equal to 12
hp_divided_by = 1; //will be used to help divide (reverse [opposite] of multiply) hp
hp_minus = 0; //will be used to help decrease hp
hp_plus = 0; //will be used to help increase hp
hp_times_by = 1; //will be used to help multiply hp
Step Event
if (hp_times_by <> 1) //if variable hp_times_by is less than 1 or greater than 1
{
hp *= hp_times_by; //variable hp gets multiplied by the amount of whatever variable hp_times_by is equal to
hp_times_by = 1; //variable hp_times_by is equal to 1
}
if (hp_plus <> 0) //if variable hp_plus is less than 0 or greater than 0
{
hp += hp_plus; //variable hp gets increased by whatever variable hp_plus is equal to
hp_plus = 0; //variable hp_plus is equal to 0
}
if (hp_minus <> 0) //if variable hp_plus is less than 0 or greater than 0
{
hp -= hp_minus; //variable hp gets decreased by whatever variable hp_minus is equal to
hp_minus = 0; //variable hp_minus is equal to 0
}
if (hp_divided_by <> 1) //if variable hp_divided_by is less than 1 or greater than 1
{
hp_divided_by != 0; //variable hp_divided_by is not equal to 0 to prevent errors
hp /= hp_divided_by; //variable hp gets divided by whatever variable hp_divided_by is equal to
hp_divided_by = 1; //variable hp_divided_by is now equal to 1
}
if (keyboard_check_pressed(ord("D"))) //if D button is pressed (pushed)
{
hp_divided_by = 2; //variable hp_divided_by is equal to 2
}
if (keyboard_check_pressed(ord("M"))) //if M button is pressed
{
hp_minus = 2; //variable hp_minus is equal to 2
}
if (keyboard_check_pressed(ord("P"))) //if P button is pressed
{
hp_plus = 2; //variable hp_plus is equal to 2
}
if (keyboard_check_pressed(ord("T"))) //if T button is pressed
{
hp_times_by = 2; //variable hp_times_by is equal to 2
}
if (keyboard_check_pressed(ord("Z"))) //if Z button is pressed
{
show_message("x: "+string(x)+"#"+"y: "+string(y)+"#"+"hp: "+string(hp)); //tells x and y position and hp amount # each on a different line of text
}
if (hp_times_by == 2) //if variable hp_times_by is equal to 2
{
x -= 2; //go left by two pixels
}
if (hp_plus == 2) //if variable hp_plus is equal to 2
{
x += 2; //go right by two pixels
}
if (hp_minus == 2) //if variable hp_minus is equal to 2
{
y -= 2; //go up by two pixels
}
if (hp_divided_by == 2) //if variable hp_divided_by is equal to 2
{
y += 2; //go down by two pixels
}
```