Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
If you don't mind, two small things from a "reviewer's perspective":
- the inner if-block can be simplified by switching if and else (the ! Is not needed)
- is the surrounding check really needed? (the position would be unchanged in the 0-case IISTC ). If the check really needs to be there, it could -depending on the sounding code- be possible to use an early return to reduce nesting depth ;) -
lxmcf204107y@losdanielos the check was just to quickly test the difference between the two movement systems, it's been totally removed for the directional system now.
And yes the outer if is needed later down the road when I add more states, also it is needed to detect when standing still and facing what direction! -
hexc11267yNo idea if you can add this in game maker but to move in most game engines you take the normalized direction vector and add it to the entitys original position vector. To normalize a vector all you need to do is divided each element by the magnitude, then when you are adding it to the position multiple delta time and speed. Ex (pos = pos + normalized(dir) * deltaTime * speed)
-
@hexc you dont have vectors in GameMaker so no you cant. The only objects available are gameobjects.
-
lxmcf204107y@CozyPlanes no comment lol, never given C++ a try but I did try to learn it a while ago, couldn't wrap my head around it.
(Plus I love GameMaker a tad too much) -
@lxmcf dont go from GML to C++ directly. Its a switch you might regret because its way to different. I suggest learning C# or Java first so you get an idea of OOP languages.
-
lxmcf204107y@Codex404 oh god no wouldnt think of it, I know C# and Java fairly well, just never could get into C++
-
lxmcf204107y@QCat I did actually try that, but no matter what math I put down, I would end up with unintended acceleration and the movement speed wouldn't be stable
-
hexc11267yYou could use the math I mentioned and just applied it to seperate x/y/z variables, also a vector is just a set of numbers so if you have access to arrays you can store vectors as arrays easily enough.
Related Rants
-
lxmcf7*uses java and c# for a few months without touching GML or my custom script language* *Jumps back in after sa...
-
danydavidpr2Once you learn to code there is no going back...
-
Aldar8GOD DAMN THE STUPID IPTABLES, aaaaah! Today I learned that iptables -I INPUT -i !lo -j DROP and iptables -...
Ok here goes me trying to explain some logic here, I apologise in advance!
I've been using an axis based movement system for my games for a while now but always had the issue of characters moving faster diagonally because the movement shape would form a square; meaning things would move at twice the speed.
Only now thought 'hang on, direction's act as circles when given a radius..'
Suddenly everything works perfectly fine and all it took was 3 lines of code... Well done Alex you tool.
undefined
gml
stupid mistake
was easier than thought