How do I Make a Negative Number Positive in Game Maker?


In an earlier question, we talked about how to make positive numbers negative. Well how do you make a negative number positive? Do the same thing as before!

Let's say we want to make a variable positive. Our variable is called myDirection and it equals -5:


Any number multiplied by 1 gives you the same number, and multiplying a negative number by a negative number gives you a positive number! So here's the code:


This code multiplies the value of myDirection by -1, and then puts the answer back in the myDirection variable. Now myDirection is positive! Nice!

Page updated: March 23rd, 2015 @ 6:21 AM Eastern Time
To help organize our content, all of our game creation tutorial content is moving to our other site:
The move will take about two months to fully complete, so stay tuned!

Game Making Tutorials
Find tutorials about your favorite game creation software! Use the navigation below!

Game Maker: Studio
Help, References, and Tutorials
RPG Maker Fes
Help, References, and Tutorials
Help, References, and Tutorials

Need Help?
Search answers to game development questions or ask a question yourself
Get exclusive updates from!
Join the Email List
Download Books
Search Downloadable Books from
Copyright 2010-2018
All Rights Reserved.