Tethering actors together?

WOLFENSTEINWOLFENSTEIN Member, PRO Posts: 64

Is this possible?

I'll describe what I want, and people can come back with possible suggestions.

I'm creating a platformer, there are certain blocks that are breakable when hit from underneath, but not breakable when you walk on top of them, and certain enemies that hurt you when they bump into you, but die when you jump on them.

This is ideally what I want:

The user controls the main actor (let's call it sim), and this is all he can see, this and the blocks, and the nice polished game, above the actor by about 2 pixels I want an invisible block staying exactly where it is in relation to sim's movements, so when it overlaps with a block, that block breaks, but if he's on top, it won't overlap, and won't break.

At the same time, I want another block below sim, so if it collides with an enemy (if sim lands on the enemy) the enemy is destroyed, but if the enemy bumps into sim, sim gets a boo-boo.

Have you done this successfully? If so, I'd love to hear from you. Does my dream of two different tethered blocks have any chance of coming true? Or will I have to take this back to the drawing board?

Comments

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    Yes, this is doable.

    But it is unnecessary. You can simply check (using a little math) to see if the actor is above or beneath 'sim'.

  • WOLFENSTEINWOLFENSTEIN Member, PRO Posts: 64

    Well my original plan before I came up with the tethering idea was to have these actors overlapped on a 0.01 second timer delay, responding exactly to the players input controls but I ran into quite a few problems.

    You say it's doable, the tethering or the idea in general?

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    Yes, the practice of constraining the y position of two actors to another one is done all the time. Here is an example.

    (Oops, I just realized this is in the "Working with GS (PC)" forum. This example was made with a Mac.)

  • WOLFENSTEINWOLFENSTEIN Member, PRO Posts: 64
    edited May 2015

    It's 5am where I am, I doubt I'd be much use looking at it given how tired and full of wine I am, I'll take a look when I wake up, I appreciate you digging that up for me.

    edit - I do have a mac with gamesalad on it, I just rarely use it as I don't like the interface, but I'm sure I can reverse engineer it and figure it out on PC.

  • WOLFENSTEINWOLFENSTEIN Member, PRO Posts: 64

    I'm having a spot of bother understanding it all, Mac and I don't always see eye to eye. I take it with the attributes like "game.simheight" - "game.simX" "game.simY", these are custom attributes,

    I'm going to attempt to just copy it and see if it works for me but I might be missing something, and I always prefer to know how it works, rather than just doing it if you know what I mean, if you could explain it as if you would to a child I'd appreciate it. :p

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    Yes, those are three custom attributes. The top and bottom actors need to know where the sim actor is. They also need to know it's height. These three attributes are used to pass that information from the sim actor to the top and bottom actors.

  • WOLFENSTEINWOLFENSTEIN Member, PRO Posts: 64

    You see to me it looked like six attributes in total.

    game.simheight
    game.simx
    game.simy
    self.possition.y
    self.possition.x
    self.size.height

    are the self. attributes saved somewhere other than the normal game attributes section? and I trust they're all 'real' attributes.

    I'm continueing to play around with it and slowly comes to grips with how they work, I've not working with real attributes before it's a bit of a kick in the brain.

  • WOLFENSTEINWOLFENSTEIN Member, PRO Posts: 64

    RIGHT! I've got it now, every actor has an X and Y value on their actor page, and you constrain them to THAT! Excellent, beautiful, your little demo helped me a great deal, thank you for your time!

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    You are welcome!

Sign In or Register to comment.