Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
if (111111.x < 0)
{
111111.h_speed = -111111.h_speed;
}
That would make instance 111111 change its horizontal direction if it went off screen to the left.
You can also make use of an object's own x and y without the prefix if the object itself is calling the code:
if (x < 0)
{
h_speed = -h_speed;
}
You can use the shortcut other.x or other.y to refer to the other object in a collision event. Code in a theoretical left wall border object, in its collision event:
if (other.x < 0)
{
other.h_speed = -other.h_speed;
}
Oh, one more thing I wanted to add. You can make a reference to something like obj_myMovingThing.x, but that is really referring to the x of all instances of that object at once (an array of x values), so it won't work right if you're trying to get the x of a particular instance.
here you go:
obj_name.x
obj_name.y