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
The thing with waits are that they do stall everything, and a lot of programming languages provide for that, but I don't hear much of a wait() being called in anything beyond a console application, because outside of multithreading you're stopping everything and that's generally not a wise decision. It's different in a command prompt situation where everything is conveyed as lines of text, but once you move past that it's generally wise to use timer variables or something like GM's alarms (which are the same concept, just automated to a fair degree for you). Generally, if you feel the need to call wait(), there's probably a better way to do what you're trying to do that won't tick off your entire program update cycle.
repeat(90){
direction += 1
}
I need a 0.3 second wait right after the //direction +=1. How could I do that?
Thanks!
Objects update every step on their own. If you have a Step event, the code within it executes every frame.
The default room speed is 30, so Step would run about 30 times a second. That said, room speed can be changed, so let's make this a bit adaptable.
1/room_speed will get us the percentage of a second that has theoretically passed, while the * 30 multiplies that percentage by our target rotation amount per second. Over the course of three seconds, that will turn 90 degrees, though it will also keep turning past that unless we put some sort of check there to make sure it still needs to turn.
As an aside, direction influences an object's motion, but not so much it's visual orientation. image_angle will rotate the object's sprite around its origin point.
Otherwise, I'm not sure what you mean.
image_index[docs.yoyogames.com] : this is the variable that tells which frame of the sprite to draw
image_speed[docs.yoyogames.com] : this is the variable that says how fast it will cycle through the frames
with this knowledge you can Stop the animation, and say which frame of the sprite you want to draw.
EXAMPLE:
EDIT: if you want to start up the animation again, just set image_speed to a positive value.