Hey people :), Ive been trying to figure out how to achieve Knytt style 'Go to the edge of the screen to move to the next bit' kind of scrolling, but to no prevail.
Could someone tell me how to do this type of scrolling?
Thanks :), Loving MMF2 btw.
Printable View
Hey people :), Ive been trying to figure out how to achieve Knytt style 'Go to the edge of the screen to move to the next bit' kind of scrolling, but to no prevail.
Could someone tell me how to do this type of scrolling?
Thanks :), Loving MMF2 btw.
Hey. Actually, you could check yourself - Knytt is open-source.
The idea is pretty simple, though.
You set the camera's center to an active "Camera".
The X of "Camera" is [color:#3333FF]PlayerX/Width*Width+Width/2[/color],
and logically, Camera Y is [color:#3333FF]PlayerY/Height*Height+Height/2[/color]
So if your window size was 640x480,
the Camera X is PlayerX/640*640+320,
the Camera Y is PlayerY/480*480+240
That's about it. This is the easiest way I can think of.
If you wonder why this works, since /640*640 seems like not changing anything: if you don't specify decimals, the result won't have decimals either.
For example,
13/10*10 = 10
but 13.0/10*10 = 13
So basically, the formula sets the camera to the player, then gets the top-left corner of the "screen", and then centers the camera by adding half the size of a screen.
Good luck, and welcome to the forums!
Ahh thats excellent! Thank you very much Looki!
Can you elaborate a bit more the
"If you wonder why this works, since /640*640 seems like not changing anything: if you don't specify decimals, the result won't have decimals either.
For example,
13/10*10 = 10
but 13.0/10*10 = 13"
part? I don't see how can 13/10*10 be 10. :blush:
"if you don't specify decimals, the result won't have decimals either."
:P
MMF doesn't work with decimal numbers unless you specify them.
Working with 15 is not the same as 15.0.
If you work with integral numbers, all decimals will be cut off.. see 13/10*10 = 10 -- MMF will calculate it like this:
=> 13/10 = 1 (10 completely fits 1 time in 13)
=> 1*10 = 10
sorry to bother you. after complete download .when i want extract .zip file.it can not open .mfa file and show this message:! D:\Documents and Settings\MEHRDAD\Desktop\Knytt1.zip: CRC failed in Knytt27.mfa. The file is corruptQuote:
Originally Posted by Looki
why?have anyone this problem?is mirror correct link?
i use winrar 3.71 for exract.please help me
Well I just downloaded it and extracted it using WinRar 3.8 and it loaded for me. Can you update your WinRar and try it again? And maybe redownload the zip file, maybe something happened in the download process.Quote:
Originally Posted by MEHRDAD