MODULE: mode7 0.3.0

Started by eri0o, Tue 29/03/2022 02:11:31

Previous topic - Next topic

RootBound

#60
@Snarky So this line throws a "cannot convert int to float" error when compiling.
Code: ags
    w = FloatToInt(IntToFloat((Game.SpriteWidth[slot]) * factor + _ox[in]) * f, eRoundNearest) - x2d;

I tried removing the FloatToInt like so
Code: ags
 w = IntToFloat(Game.SpriteWidth[slot]) * factor + _ox[in] * f, eRoundNearest - x2d; 
which of course gave a "cannot convert float to int" error. Not sure if it's being affected by a line somewhere else. There's also a lot of int/float conversions around generally, so I'm not sure which spot in the chain is throwing the error.  x2d is an int at this point, so I don't THINK that's the problem. It might be the _ox[in] piece, but I tried putting an IntToFloat around that too, and it didn't fix anything. Probably I'm just making a fool of myself.
They/them. Here are some of my games:

Snarky

Quote from: RootBound on Thu 10/10/2024 13:54:19@Snarky So this line throws a "cannot convert int to float" error when compiling.
Code: ags
    w = FloatToInt(IntToFloat((Game.SpriteWidth[slot]) * factor + _ox[in]) * f, eRoundNearest) - x2d;

My error with the parentheses. Hopefully this works better:

Code: ags
    w = FloatToInt((IntToFloat(Game.SpriteWidth[slot]) * factor + _ox[in]) * f, eRoundNearest) - x2d;

RootBound

#62
@Snarky It compiles!

At first the jittering actually looked a little worse (though seemingly smoother?) but then I switched the + and - signs in the equation, as you suggested earlier. There seems to be some jitter still present, but I do think less? The image of each sprite also seems to visibly change more frequently.


Thanks for your code!

EDIT: Hmm, now that I test it more, the vertical jitter seems to have been replaced by a bit of a side-to-side shivering, especially when objects are far away and camera movement is slower. I suppose I'll do a little more comparing of both methods and decide which I like better.
They/them. Here are some of my games:

Snarky

#63
Great! You could try using just the change to the height calculation and not the width change. (The code appears to place sprites based on the horizontal midpoint, which is another calculation that could induce jittering.)

RootBound

Quote from: Snarky on Thu 10/10/2024 19:05:03You could try using just the change to the height calculation and not the width change.

Huh! That seems to actually result in the best of both worlds. I would never have thought of that. Much appreciated!
They/them. Here are some of my games:

SMF spam blocked by CleanTalk