Game Mechanic help

Rocktapus

  • *
  • Posts: 28
Hi everybody.

I've been tearing my hair out trying to figure out how to get this to work for the last few days and I was hoping somebody here might be able to me.

 I'm trying to build a mechanic similar to the one in those bridge crossing games where the player grows a bridge and it falls to the right to cover a ravine  - sorry I can't remember the name of the game but I've attached an image that gives the general idea.

Basically I want to grow a tower along the Y axis to a custom height and then have it rotate exactly 90 degrees to the right and I'd prefer not to use the drawing blocks as I'd like to have a collision happen somewhere along the tower.

Sounds simple, or so I thought.

I started by trying to use joints to hold several small blocks together to form the tower but that proved unstable using both weld and / or distance joints. I've also tried just using coordinates to hold them in place but the math got too complicated when I tried to rotate the tower. I've also tried using the extensions to change the actors collision box size and origin point but neither worked.

Basically this is driving me a little crazy as I think it should be fairly easy to do but I just can't seem to find a way. If anybody can point me in the right direction or has any ideas it would be much appreciated.

Thanks 
John





Luyren

  • *
  • Posts: 2802
Have you considered using this block?
You can then set the origin point of your actor to bottom middle, and give it a positive rotation speed.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.

Max Marin

  • Posts: 138
Sorry I didn't understand. Are you trying to do something like this?
I'm human

LIBERADO

  • *
  • Posts: 2720
Weld Joints work well for me.

I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

Rocktapus

  • *
  • Posts: 28
Thanks to everyone who replied.  :)

I've managed to achieve the effect I was looking for using the Image API. I'd been trying something similar to Luyren's suggestion (enlarging an actors collision box, fixing other actors to it and then rotating them all by the bottom box) when it occurred to me that the image API would be perfect for this and cut out my need to manually fix each the actors together.

In the end I just used a single block actor that I then add image instances to and it all rotates nicely around the same axis. I can even store the images in a list so its easy to add and remove them.

Liberado -Your mastery of the joints extension never ceases to amaze me. I messed around with a similar idea for far too long and wasn't able to achieve and effect anywhere near as nice as this. Would you mind sharing how you did it? Is it just a single weld joint attached to the centre of each block? I tried both one and two joints and couldn't get anything this stable. Also would you mind sharing how you rotate the structure, are you applying a push force to one of the blocks or is it a rotating?

Thanks

LIBERADO

  • *
  • Posts: 2720
It is just a single weld joint attached to the bottom edge of each block. To rotate the structure, I simply apply a push force to the highest block.
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

Rocktapus

  • *
  • Posts: 28
Thanks Liberado