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

For questions about using Classic.

Post » Thu Sep 04, 2008 1:12 am

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?
B
1
G
4
Posts: 7
Reputation: 1,039

Post » Thu Sep 04, 2008 3:00 am

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.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Thu Sep 04, 2008 6:59 am

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.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Thu Sep 04, 2008 12:48 pm

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"
B
1
G
4
Posts: 7
Reputation: 1,039

Post » Thu Sep 04, 2008 1:26 pm

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.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Thu Sep 04, 2008 2:43 pm

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?
B
1
G
4
Posts: 7
Reputation: 1,039

Post » Thu Sep 04, 2008 6:29 pm

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 :D.
B
3
S
2
G
5
Posts: 263
Reputation: 2,201

Post » Thu Sep 04, 2008 10:24 pm

[quote="webrunner":xzznbdw3]So.. if you have two platforms, you'd have to code each one seperately and not use a "MovingPlatform"[/quote:xzznbdw3]

I'm not sure what you mean.

[quote="webrunner":xzznbdw3]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?[/quote:xzznbdw3]

No, that doesn't sound too normal.

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

[quote="Drasa":xzznbdw3]I'd like to see some overall improvements in platform behavior... lorem ipsum dolor sit amet[/quote:xzznbdw3]

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.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Fri Sep 05, 2008 10:51 am

[quote="deadeye":irjcwm6z]
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.[/quote:irjcwm6z]

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.
[quote="deadeye":irjcwm6z]
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.[/quote:irjcwm6z]
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?
B
3
S
2
G
5
Posts: 263
Reputation: 2,201

Post » Fri Sep 05, 2008 2:07 pm

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?
B
1
G
4
Posts: 7
Reputation: 1,039

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests