Okay, I seem to be having a problem with off-screen collision detection.
My goal: Create a platform game demo with a 400x300 display and a Virtual Width of 1200. I have items that need off-screen collision detection so I have to turn that on.
My Problem: Turning on "Handle background collisions even out of window" for some bizarre reason causes my sprite to fall through the floor (as if collision detectio were on for everything else except the main sprite. All I have to do is move the sprite to the center of the level and long before he gets there he goes straight down - like his collision detection only worked in the 400x300 box.
The reason is that MMF2 handles collisions in the invisible playfield when the option is added, but it still only handles collisions *inside the playfield*. The entire level is represented in MMF2 by a bit array, each pixel being assigned either a 0 or a 1, for being a collision or not (actually a 00, 01, 10, or 11, for non-obstactle, platform, ladder, obstactle). But this array is only the size of the level itself. When you are displaying areas that are not in the level, they will not be saved to the collision mask, and you can't collide with anything
its actually a kind of stupid system, since the collision mask takes up twice the space it should. The platform and ladder settings can only be referenced by the built in movements, so theyre useless in more serious apps, but still double the size
Originally Posted by Sketchy In the frame settings, set "size" and "virtual width/height" to 1200x300.
In the game settingss, leave "size" as 400x300.
Nice platform engine btw.
Thanks! That did the trick. That is *slightly* upsetting, though, because I was hoping to set the Frame Fize to 400x300 and the Game Size to 800x600 (with "Resize display to fill window size" checked) to essentially double the screen size. Is there another way I can do that?
Also, the platform engine is David Newton's. I'm not fully done implementing it, though. It is pretty cool, though.
Originally Posted by Pixelthief Yup, as Sketchy says.
The reason is that MMF2 handles collisions in the invisible playfield when the option is added, but it still only handles collisions *inside the playfield*. The entire level is represented in MMF2 by a bit array, each pixel being assigned either a 0 or a 1, for being a collision or not (actually a 00, 01, 10, or 11, for non-obstactle, platform, ladder, obstactle). But this array is only the size of the level itself. When you are displaying areas that are not in the level, they will not be saved to the collision mask, and you can't collide with anything
its actually a kind of stupid system, since the collision mask takes up twice the space it should. The platform and ladder settings can only be referenced by the built in movements, so theyre useless in more serious apps, but still double the size
Originally Posted by Pixelthief The platform and ladder settings can only be referenced by the built in movements, so theyre useless in more serious apps, but still double the size
That's not *totally* true. You can use the collision mask to check for ladders/platforms, but yeah, it would be a lot better if there was a condition for "object is overlapping ladder" (wouldn't have been that hard for clickteam to add either, you wouldn't think).
Jess:
I'd suggest just running fullscreen, and changing the resolution.
Alternatively, you could use the "window control" extension, but it's really slow.
+ start of frame
-> set horizontal size to 800
-> set vertical size to 400
Make sure you tick the "resize display to fill window size" box in game properties, or it won't work.
You might be able to do it using the viewport extension instead, but don't ask me how.
Originally Posted by Sketchy I'd suggest just running fullscreen, and changing the resolution.
Yeah, I was trying to stay away from that. Not that it wouldn't work, but rather I'm working on a laptop and when I resize the screen (to anything except the optimum) it looks pretty crappy.
Originally Posted by Pixelthief Couldn't you load the main game from a separate frame as a sub-application, and then resize that frame?
I might be able to do that if I weren't so El Stupido! Haha. I tried sifting through the controls and couldn't figure that out.
And, having said that, I have to say this too: Something is freakin' rotten in the state of Denmark!!!
Why do I say that? Because I have found a resolution... of a sort - which I neither like nor can explain. Who is up to finding out what's up?
This MFA file contains two frames:
1. Working Frame - which, as the name implies, works!
2. Non-Working Frame - yeah, it doesn't work
In the first frame, the player can walk all the way down the field and NOT drop through the obstacle background. In the second frame, once the player walks past past the initial screen... AAAAAAHHHH!!! ... right through the floor!
Now I swear to you that the settings in these two frames are exactly the same. Check them out and see for yourself. I'm saving up a big "j00 DA man!" for the guy who figures this out. Like I said before, I'm far to El Stupido to do it myself.
Also, you'll note that the first frame accomplishes exactly what I want:
1. Allows me to create a classic-style 320x200 game (although I'm doing it in 400x300)
2. Let's me resize the display to 800x600 without needing to change the resolution
3. Have the game look nice and crisp on a laptop monitor
Who is up for the challenge? Now, if you're curious as to how I created the first frame -- here is how I did it. I knew that David Newton's demo file that came with his excellent tutorial (http://www.clickteam.com/eng/resources/fastloop_plattutorial.zip) did have the "Handle background collisions even out of window" turned on and his sprite didn't drop through the floor straight to Hades. So I:
1. Opened his demo in TGF2
2. Opened my application in TGF2
3. Dragged the last frame from him demo to my app
4. Deleted all of the objects and events from his frame
5. Copied all of the objects and events from my frame into this now blank one
Sorry about bumping such an old thread but David Newton helped me figure out how to resovle this problem - so I thought I'd post the resolution.
The only difference between the working and non-working frames is that the working frame has an extra layer (which happens to be completely empty). That's it. If you delete that empty layer from the working frame then the background obstacles stop working when the sprite reaches a certain distance from the start. Pretty strange... and sounds like a bug.