H
Halph-Price
Guest
Just wondering if to change speed and angle does it translate to the hspeed and vspeed variables, or is it separate. Either way, anyone got any good collision tips for overhead games?
Okay, thanks a lot, documentation doesn't really mention it, but it seems likely... hard to know what's related.If you change hspeed and vspeed, speed and direction will automatically change to match, and vice versa.
I am using paths in the game tho, and it does seems like speed and such is kind of useless in this operation.That's actually kind of a good part about Gamemaker...the majority of those automatic object variables update each other when you change them. The only exceptions to those that I've found are when you are using the Box2d physics(and you actually get a separate set of vars for that), and when you use paths for movement.
About collision tips for overhead games...I'd use a lot of circles for collision masks. You don't want to use pixel perfect masks because things can easily get stuck. Note that this actually applies to almost all games.
unless you're moving by xy position or motion planning, because one is like teleporting and the other is an isolated function it seems.Speed is the speed that your object is moving.
Hspeed is the speed that your object is going, horizontally.
Vspeed is the speed that your object is going, vertically.
Those are 3 very different things, which can be related via direction.
In GameMaker (and most other things), the default direction (zero degrees) is the equivalent of "straight to the right." And then you proceed counter-clockwise. So 45 degrees is up and to the right, 90 degrees is straight up, 135 degrees is up and to the left, 180 degrees is straight to the left, and so on, until 360 degrees (a complete circle) points in the same direction as 0 degrees.
Suppose that you have an object moving diagonally at 45 degrees--up and to the right--at a speed of 5 pixels per step. The object's speed is 5. The object is moving horizontally and vertically at the same time. It's moving less than 5 pixels to the right, and less then 5 pixels straight up. But the combination of movement in the 2 directions results in 5 pixels diagonally. If you change the speed, the hspeed and vspeed will update. If you change the vspeed or hspeed, the speed will update. GameMaker links these together.
Yeah, you would be right about that. I'm understanding you can change how fast the object moves along the path, but of course it won't work the same. If you need to know speeds in pixel units when things move along the path, you can always store the current x/y into variables, and in the step event compare the previous x/y with the current x/y. You can get distance and direction this way for if you need it for something.I am using paths in the game tho, and it does seems like speed and such is kind of useless in this operation.
GMS2 actually has a xprevious and yprevious variable that is set before the start of the 'begin step event'.Yeah, you would be right about that. I'm understanding you can change how fast the object moves along the path, but of course it won't work the same. If you need to know speeds in pixel units when things move along the path, you can always store the current x/y into variables, and in the step event compare the previous x/y with the current x/y. You can get distance and direction this way for if you need it for something.
It exists in GM 5, one of the first versions of game maker sold, as well. It's a rather old and extremely useful functionGMS2 actually has a xprevious and yprevious variable that is set before the start of the 'begin step event'.