Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

Bionic Commando swinging?


Recommended Posts

Before we start: I'm working on MMF2 with as few additional extensions as possible.

Assume that I have a player character that uses a static engine to move around the level. Assume that he has two other active objects to work with - a large claw object (to grab platforms or objects) and a chainlink object (which can be duplicated to connect the two). At the moment it looks like this (frame editor screenshot, hence the example placement of objects):

warningtestgraphicsinuse.png

Also assume that the game won't look so asstastic later. This isn't a Mario fangame, it's all test graphics.

Anyway how do I set up an event group that allows the player to extend a hand in friendship towards platforms cling onto platforms/ceilings and swing around all willy-nilly? I don't need Umihara-level physics, just something to let the player swing left, right, and maybe climb up/down the claw-arm too. Like if you want to make the swing shorter and bring the player closer to the platform, you press up (bringing the player closer to the claw/hook/whatever). And if they overlap with a pass-through platform they climb up and on the platform (like in Bionic Commando where you can scale buildings by doing this), but if there's like a huge chunk of background in the way then they just dangle from the ceiling?

:ahuh:

I can reliably set up an event where pressing a button fires the claw a short distance (in your chosen direction, natch) and holding the button down would make said short distance a bit longer (counters, etc). It's the actual 'create the right number of links between you and the hook' and the whole 'swinging' thing I can't get my head around.

sonofwarningtestgraphicsinuse.png

This is pretty neat too, don't get me wrong, but in terms of what I'm aiming for it's swing-and-a-miss.

Link to comment
Share on other sites

Clwe made a game with the grapple hook many years back, and you can get the source for it here.

Just off the top of my head though, you could use the line equation to limit the number of links - absolute value of (Player's Y - Claw's Y) / (Player's X - Claw's X). This should be the distance between the Player in the claw...divide that number by the diameter of the chain length object, and that'll tell you how many chain-links should exist at any given time. You could use that number to limit how many are created, or destroy them when the chain starts shortening.

  • Like 1
Link to comment
Share on other sites

Clwe made a game with the grapple hook many years back, and you can get the source for it here.

Thanks for the link! I'm going to try and decipher the events list and see what I can learn from the grappling hook commands.

I can't help you with this but I just wanted to say that's a pretty awesome idea for a Mario game.

Actually it's not for a Mario fangame. In fact it's not going to be a fangame at all... although if I'm allowed I'll submit it for SAGE.

I may have an engine somewhere that has a grappling hook programmed into it. Maybe I could PM you the mfa if you want?

Sounds good!

Link to comment
Share on other sites

On a related note, let's say I have five duplicates of an active object. How do I assign them each a different Alterable Value - duplicate 1 has AltValA=1, duplicate 2 has AVA=2, etc?

EDIT: Spread value.

DOUBLE EDIT: if I have [x] duplicates, and I spread value '1' in AVA, how would I get the largest value from a duplicate object? Say if there's 5 dupes and the largest value is 5, or there's 20 dupes and the value is 20, etc?

TRIPLE EDIT: Ok, scratch that, I have a working trigonometric swing with a starting point (circle), [x] number of chain links and a platform. I can modify the number of links and the swing works regardless. All I need to do now is convert that experiment into a swinging mechanism for the final game.

http://dl.dropbox.com/u/27392295/modifiedswingphysics.exe

Link to comment
Share on other sites

That swing feels incredibly sticky and automated. When I say automated, I mean. Not using actual SIN COSINE code to give it it's swinging physical look.

It does use sin/cos in the event list, it's just a matter of customing the Alt Values to get the accel/decel to feel 'right', particularly on larger swings where the accel seems pathetically fast in comparison to the decel. Then again I'm hardly an expert on trigonometry so I can stand to be proven wrong in great detail.

http://dl.dropbox.com/u/27392295/modifiedswingphysics.mfa

Link to comment
Share on other sites

Context: 'mask' is obviously the active object used to test for backdrop collisions. Group.Neutral defines the chain-links. Group.Good defines the crab claw(s). This code sets the position of the objects while future events juggle the numbers necessary to put the swing in motion.

[LIST]Movement of 'mask' = 4
+Alterable Value A of Group.Neutral = 0
=Start loop 'give IDs' 1 time(s)
[/LIST]
[LIST]On loop 'give IDs'
=Spread value 0 in Alterable Value A of Group.Neutral
[/LIST]
[LIST]Movement of 'mask' = 4
= 'mask' Set X position to "X( "Group.Good" )+((value( "HighestFound" )*6)*Sin(Alterable Value C( "Group.Good" )))"
= 'mask' Set Y position to "Y( "Group.Good" )+((value( "HighestFound" )*6)*Cos(Alterable Value C( "Group.Good" )))"
= Group.Neutral Set X position to "X( "Group.Good" )+((Alterable Value A( "Group.Neutral" )*6)*Sin(Alterable Value C( "Group.Good" )))"
= Group.Neutral Set Y position to "Y( "Group.Good" )+((Alterable Value A( "Group.Neutral" )*6)*Cos(Alterable Value C( "Group.Good" )))"
[/LIST]

Problem: this code is obviously vital for setting the position of the player. However I can't successfully set up any events to test for backdrop collision - e.g. to stop the player from swinging through platforms from below, or to test if the floor detector 'lands' on a platform when the player swings 270 degrees. I mean, I know how to set those events up in MMF2, don't get me wrong baby steps, but these tests in the Events List inevitably result in me running the frame, executing the fire-claw-into-ceiling-press-direction-to-activate-Movement=4 routine, only to have the player instantly stuck in the backdrop where the claw connected. And the chainlinks don't reposition themselves, naturally. I'm absolutely sure it's to do with that 'set x/y at' event in the code but I'm at a loss as to how to go about fixing this.

For the sake of context this is a copy of the source file I'm working on at the moment, though the events list will be a nightmare to decipher.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...