Platform Behavior.. Making it 'play nice' with customs

This forum is currently in read-only mode.
From the Asset Store
Make your own platformer for both the web and mobile easy with this Santas Platformer Template, FULLY DOCUMENTED
  • I'm working on something using platforms, and I looked through the forums/wiki didn't see anything, so I have two questions:

    Is it possible to tell it to act like an object is solid from an Event? I want to make 'jump through' platforms, but that requires it acting like a solid when jumping and acting not like a solid when falling. Is the best way to do that to actually change the solid/non solid of the object? I dont want it toggling blocking other things like monsters

    Also, is it possible to make a moving platform that can 'carry' the player? Say, if it moves left the player moves left too?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The way I made jump-through platforms in my game is if the bottom edge of the player Y is greater than the top edge of the platform Y, then the platform is not solid. If the beopY it less than the teopY then the platform is solid. This worked fairly well unless an enemy happens to be passing through the platform at the same time the player is.

    All of my experiments with making jump-through platforms have worked to a certain extent, but they always seem to have small problems like that. For instance, if you make a custom push-up routine where the platform automatically updates the player to the top of the platform if they're falling, then it's possible to miss the top edge of a platform, and enter it from the side and get pushed up anyway, which just looks funny. I suppose you could get around this by making your platforms 1px tall, but that would be a pain to work with in the layout editor.

    The Platform object for MMF handled this kind of thing automatically, where you could specify "player is overlapping a jump-through platform" for certain objects. It worked great. In that regard, the Platform object was one up on Construct's.

    I was thinking of requesting that there be more than one kind of "Solid" attribute, just for this kind of thing... objects that are only solid if passing through on one side. Like "Solid on top," "Solid on left," etc. I don't know how useful that would be to a lot of people though (It would be useful to me for sure).

    As for the moving platforms, it's a matter of adding the speed of the object to the speed of the player. There are a few different ways you could implement that, but I'm sure you can come up with something. In my experiments, making horizontal platforms is way easier than vertical ones. My vertical ones always make the player jitter around, and I can't seem to get the motion smooth.

    Again this is where the MMF Platform object has a leg up on Construct... there were two different speed settings for the PMO: Velocity and Additional Velocity. If a platform had Velocity x and the player was on top of it, all you had to do was say "Set Additional Velocity to platform velocity x" and it would automagically work. So if the player was running at 50, and the platform is moving at 50, then the total speed of the player would be 100. Easy. It's a little more complicated in Construct, but it is doable.

    I'll mess around with an example and post it later, but right now I have to watch the season premier of Bones.

  • Hey, I know I said I'd post some examples but I'm feeling kinda lazy right now.

    Hopefully my post gave you some ideas to start tackling the problem on your own. If not, go ahead and PM me and I'll get around to it later.

  • What would be the best way to determine if a player is 'standing' on a platform? On Ground + Collide seems like it would work.. but what if you're standing on the ground, the platform is next to you and you're touching it, and it's moving away, wouldnt that 'drag' it with you?

    There should be a "is standing on" option for the platform behavior.. so we could say "is standing on [platform family]" -> "move based on [platform family] movement"

  • I generally have a detector sprite a couple pixels tall placed at the foot of the player sprite to detect when it's in contact with the ground, or a platform, or an enemy's head, or whatever.

    As for the platform dragging you away, yeah those are the kind of little bugs you need to try to work around when you're adding custom stuff to the platform movement. Generally it's about defining your conditions as specifically as you can, like so for example:

    +foot detector is overlapping platform

    +foot detector is not overlapping ground

    +player is not jumping

    +player is not climbing

    +player has a brown dog named fred

    • move player on platform

    It's basically all about coding for every contingency. It gets a little tiresome, but your engine will only be as smart as you tell it to be.

  • So.. if you have two platforms, you'd have to code each one seperately and not use a "MovingPlatform"

    I also seem to have another problem: a platform moving vertically under my character seems to push the character left as well as up, for no reason I can discern. Is this normal behavior?

  • I'd like to see some overall improvements in platform behavior... It's still too limiting for anything too serious. Moving platforms, one-sided solids, ladder climbing, edge gripping, walljumps, better-looking suspended jump (the current looks like suspended float, there should be better algorithms to do a suspended jump), event-simulated controls for cutscenes, different solids for different objects (some object could cross a wall that another couldn't), and lots of customability. More trigger conditions (bumps into floor[=lands]/ceiling/left/right) and more actions (simulating controls, halt a jump [simulate ceiling bump ], setting sprite-specific solids, and when advanced features are added clinging to a ladder, etc. )

    The behaviors' idea is to bring so good basic functionality that user doesn't necessarily have to create his own, but the functionality should also be very extendable so that user could use behavior as a base and implement some additional features... or that's what I think .

  • So.. if you have two platforms, you'd have to code each one seperately and not use a "MovingPlatform"

    I'm not sure what you mean.

    I also seem to have another problem: a platform moving vertically under my character seems to push the character left as well as up, for no reason I can discern. Is this normal behavior?

    No, that doesn't sound too normal.

    Perhaps you could post a .cap and I could take a look at it.

    I'd like to see some overall improvements in platform behavior... lorem ipsum dolor sit amet

    One-sided solids (aka jump-through platforms) and ladders are pretty common common features in platform games so I can see those being added as features (even though coding a ladder is a piece of cake). Things like gripping a ledge or wall-jumping aren't such general features though, and should probably be coded as needed by the user. Just my opinion on the matter.

    And I guess I don't see what what you mean about the jump, it looks pretty natural to me. Maybe you could try fiddling around more with gravity and jump strength and such, you can get different looking jumps out of it.

  • Things like gripping a ledge or wall-jumping aren't such general features though, and should probably be coded as needed by the user. Just my opinion on the matter.

    Well yeah, I agree. I actually meant that there could be additional conditions to help coding there features, something like that there would be events testing a bump on the wall and then user could code that if jump control is pressed within a certain time, jump would happen. Currently that needs detectors. I thought that if behavior knows internally when it has bumped to a wall, it could as well trigger an event too.

    And I guess I don't see what what you mean about the jump, it looks pretty natural to me. Maybe you could try fiddling around more with gravity and jump strength and such, you can get different looking jumps out of it.

    I mean that when the jump key is pressed, the jumping sprite rises at very steady speed, like it was floating. This stands out especially with long jump sustain times. Seems like the "gravity" starts to effect only after the jump key is released or the maximum sustain time has elapsed. If the sprite's upward motion was decelerating even when the sustain key is pressed, it would look more natural. Of course, when jump key was released, the decelerating/downward acceleration must be greater. Maybe there should be "gravity during sustain" so that user could tweak this setting?

  • I managed to fix a lot of my issues:

    • I made a 'foot' detector under the Platformer object. When it's overlapping a "MovingPlatform" family (and "MovingPlatformSprite" and "MovingPlatform3D") object, and 'is on ground', it goes through the following:

    -- If the platform is moving left, then move the sprite left, unless the left detector hits a solid. This is important because otherwise moving the sprite left will happen after the platformer logic but before the next set of platformer logic, causing what appears to be a bug to manifest in the platformer logic: if any part of the platformer sprite, including parts that aren't colliding (because they're transparent), is overlapping a solid at the front of a frame, it bumps it up to the top of the platform immediately. This means if your detectors are outside of collision area but inside the bounding boxes, then you might have trouble.

    -- Do the same with right

    -- For up and down, move the sprite up PLUS one more, or down PLUS one more. This avoids the 'push to the left' issue. Which I think can be easily shown by just having a platformer object, a solid object under it, and moving the solid object up.

    • When the head detector is overlapping a moving platform moving down, then move the sprite down, otherwise it ends up 'popping' above the platform.
    • When the left/right detectors are overlapping apltform moving right/left, push the character.

    I do have a weird issue still where sometimes if you jump on to a platform that's slightly off the ground that's moving toward you, it warps you beneath the level, but I can't find where that's happening. I'll have to wait until debug is fixed. And another where I can get 'hooked' on to the side of a platform moving towards you, but these are compartively minor bugs in that I got the movement correct.

    But, to clarify: There's no way to 'simulate' being on a platform using the platform system? It's either solid or nothing?

  • Er, I must be blind or something, how do I change the attributes of an object in order to make it say, turn solid on and off depending on where the player is? There doesnt seem to be a "Toggle Attribute" function

  • Er, I must be blind or something, how do I change the attributes of an object in order to make it say, turn solid on and off depending on where the player is? There doesnt seem to be a "Toggle Attribute" function

    It's under Sprite actions: Collisions: Set Collision Mode (None, Point, Per-Pixel, Solid)

    And congrats on working things out. It sounds like you're on the right track (and just about at the same point I am as far as moving platforms goes). If you perfect your platforms, post an example

  • Here's what I've got so far, there's a couple of random glitches that make it not trigger the 'crush' function, but the gist is there.:

    http://www.savefile.com/files/1775634

    • Press ctrl to fire, shift to jump, and arrows to move
    • Press 1, 2 to switch weapons
    • There are three different Moving Platform families, for three different object types. They pretty much work the same.
    • There's some simple enemies
    • There's a save room two screens right from the start location.

    I noticed there's a bug with the Save/Load - if you try to load a save from a different layout it crashes. As a result it also saves the -layout- to a different file, loads THAT first, and now it doesn't crash.

  • Not bad. Your vertical platform is about as good as I've ever been able to do, what with the jittering and all.

  • The going-up-jittering could be avoided if only leaving it to it's own devices didn't push it left too :/

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)