I'm making a new platformish type game and it's using a scrolling method similar to Knytt, by which I mean the screen is perfectly still until the player starts to leave it and then the screen snaps to the next veiw/location.
The weird thing is, when the screen snaps to the new location, some of the backdrop objects flash for a millisecond...
Another strange problem that's similar is when I snap from one side of the frame to the other (about 2000 pixels) some objects from random parts of the level flash really quickly and then the correct thing is displayed.
Not sure what's causing this.. :S It seems to happen more to light or vibrant backdrop objects that are ontop of dark objects...
Sounds pretty strange, have you tried fiddling with the objects settings, such as "Destroy if too far from frame" or "Inactivate if too far from window" .. are you using ink effects etc etc?
Everything is at once. The backdrop objects don't have those properties Jthongbai, but thanks anyway.
It's really odd, I will give you an example:
There's a fridge in the middle of my frame as an active object. I'm at the right side of the entire frame (2000), and upon pressing "enter" I snap to the left side of the frame. But when I press enter, an image of the fridge flashes for a tiny microsecond before it shows the left side of the frame. It does happen mostly with backdrops, but it does with a few actives too...
I have no idea what's causing this It's like the frame is, instead of snapping to the right location, zooming there in an insant and showing flashes of everything it goes past :S
The character is 20 pixels wide and the screen in 400 pixels wide btw...
- X position of "player" >= X Right Frame-10
> Centre display at X=X Right Frame+200
- X position of "player" <= X Left Frame-10
> Centre display at X=X Left Frame-200
This only does side-scrolling as I havn't yet added the vertical scrolling feature yet. It snaps the frame 400 pixels in either direction, depending on which direction the character leaves the window...
Originally Posted by -Julian- This is how I'm doing the scrolling:
The character is 20 pixels wide and the screen in 400 pixels wide btw...
- X position of "player" >= X Right Frame-10
> Centre display at X=X Right Frame+200
- X position of "player" <= X Left Frame-10
> Centre display at X=X Left Frame-200
This only does side-scrolling as I havn't yet added the vertical scrolling feature yet. It snaps the frame 400 pixels in either direction, depending on which direction the character leaves the window...
That's your problem. When you do it that way, it shows each screen it goes past for one frame (About 1/50 of a second). You could use a value for the camera position and use it for the scrolling. (Or something like that. I'm unfocused right now, so this is coming out like mush.)
I'm thinking of just using an active object as a camera and setting it's coordinates when I need to. Of course, the frame position will always be set to look at it so yeah maybe that will work :S
---Edit---
Well I managed to get the scrolling working with only one event and no camera object (I used a value called "camera" instead, suggested by RedEchinda) and now I can snap from one side to the other without any display problems.
There's still some slight background object graphical problems though when scrolling 400 pixels at a time. The frame is 400 pixels wide and the "player"'s Hot Spot is centered.
Always
>Set Camera to: Ceil(X( "Player" )/400)*400+200
>Center display at X: Camera
It sort of looks like the backdrop objects are only loading when they are in the visible window, but that shouldn't be the case.. :S
That's like the formula I was using in my last post (Just without the Y dimension), this is helpful but I still can't understand why the graphics are behaving strange... After a few tries I managed to capture one in a screen shot:
The big piece of wall down the middle and the blue tiles aren't supposed to be there. They flash for a second and then the screen goes to normal like this:
hmmm. that code shouldnt make it do that. it might be computer related? do you have the latest mmf2 build (r24? have you compiled it and run it on other computers?
Yep, I'm using build R248 and nothing like this has ever happened before :S
This is a screen capture, just as the screen changes from one side of the room (Picture in last post) to the other side, which is only 400 pixels to the left.
As you can see, this is when the lights are off. There's red carpet on the side, and a few other graphical errors. The thing is, all the graphical errors are in the correct place as if you were looking at the last screen, like on the other side of the room there is carpet in the bottom-left and a wall on the right etc...