Collision with rotating objects

For questions about using Classic.

Post » Sun May 17, 2009 3:14 pm

First of all: "Hello everybody, I just registered to this forum" :wink:

Recently I discovered Construct and I am really satisfied with what I get and what I can do with it. Its a great program and its lots fun to play with.

The last two days I spent my time creating a small sidescroller to learn handling the program. Yesterday night (until 3am in the morning -_-)I tried to solve a problem concenrning the player colliding with a rotating object. I will try explaning it further:

Think of a seesaw (a solid box with a sine behavior) and the player stepping on this seesaw. Now, when the seesaw moves the player slides along with it and somehow construct thinks that the player is falling and plays the falling-animation for just about a millisecond. That causes that the player jiggles alot, which of course looks very strange.

I tried changing the collsion mode from point to bounding box to per pixel and I added another condition to "If Player is falling" + "If no key is pressed" and several things with "overlapping" and "collison" with the rotating object. But nothing worked so far.

So, my question is:
How can I make the player doesn't jiggle on a rotating object? Is there any hint I haven't discovered yet? Hope you guys can help me out.

Thanks in advance!
B
1
G
3
Posts: 3
Reputation: 831

Post » Sun May 17, 2009 3:40 pm

you have to manually move his position, or put a buffer of 2 frames or wtv for the falling animation to activate.
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Sun May 17, 2009 4:34 pm

you could also check for "player is overlapping object at offset"

something like:

[code:3k9ig7ty]
+compare player is overlapping platform at Y-3 or greater
-animation set to "standing"
[/code:3k9ig7ty]

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Mon May 18, 2009 6:06 pm

Thanks for your answers.

@QuaziGNRLnose:
How can I move the player in a non absolute way? Like this: "current position in Y" +1. It seems that I can only type in an absolute number in the "Set Y"-field. And how do I create a buffer for the animation to trigger? Should the animation consist of 3 frames (1+2: Standing, 3:falling)? Then I would need another falling animation for when the player really falls.

@SoldjahBoy:
I already tried that and the problem is that if I then want to move the player the walking animation doesn't play because its overwritten by the falling-animation. Therefore I added another condition (If no key is pressed)....but somehow that doesn't work either :/

Here's a little screenshot to clarify the problem:
(Think of the house swinnging from left to right)



There must be a way...
B
1
G
3
Posts: 3
Reputation: 831

Post » Mon May 18, 2009 6:42 pm

[quote="grrt":kkw8qxi6]Thanks for your answers.

@QuaziGNRLnose:
How can I move the player in a non absolute way? Like this: "current position in Y" +1. It seems that I can only type in an absolute number in the "Set Y"[/quote:kkw8qxi6]

You mean "Set Y to Player.Y + 1?" You write that pretty much in the manner you described. Check out the wiki on expressions. You can get an expression for an object by typing "objectName." in the expression editor. After you type the "." a dropdown list will pop up and show you all the expressions that you can retrieve for the object. Alternately, you can double-click an object in the lower pane of the editor and pick one of the Get's. Like, for instance, "Get Y."


As for your other issue:
First, "On any key pressed" is a trigger, you can't really negate it. "On key pressed" triggers ONE time in the first tick that you press a key. "Key is down" triggers every tick that the key is down.

Second, you're detecting the object below the player's feet with the offset, yes? Then you only need to set the offset in the Y axis. So your condition would read "Player overlaps house at Offset (0,3)"

You might want to rework your events so they read like so:

[code:kkw8qxi6]

+ Player: Is falling
+ NOT Player: Is overlapping Solid at offset (0,3)
-> Sprite: Set animation to Falling

+ Player: Is Jumping
+ NOT Player: Is overlapping Solid at offset (0,3)
-> Sprite: Set animation to Jumping

+ Player: Is overlapping Solid at offset (0,3)
+ Player: Is walking
-> Set animation to "Running"
+ Else
-> Set animation to "Standing"

[/code:kkw8qxi6]

Also, this probably isn't going to be the end of the issue. I can tell you now that getting a platform object and it's sprite to look 100% good on a teeter-totter is probably going to be a chore. It's going to likely require a lot of custom events with advanced math to place the objects and set their angle in relation to the platform. Special circumstances require special solutions, and what you're doing is a bit beyond the scope of the platform behavior.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Tue May 19, 2009 9:37 pm

wow deadeye, thanks for your help and explanations. That "Set Y to Player.Y + 1" really did the trick. The player still jiggles a bit (no chance of getting rif of this?) but the "falling" animation doesn't activate if the player is not falling. Looks much more normal now. A big step forward! :)

I've still got another question :roll: Is it possible to "pin" the player to the swinging house. Right now, when the house swings to left, the player holds his position so that it looks like he's sliding on that house. I guess that might be a bit trickey, right?

I know these are not typical platform features but I want try a few things before I might begin creating a full game. I want to test the limits so I can plan what I can do and what I can't do.
B
1
G
3
Posts: 3
Reputation: 831


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests