Absolute and relative top of an actor

PetCroPetCro Member Posts: 21
Hi guys,
I would like to create a game, where I have 4 invisible actor-objects (on the top, bottom, left and right side of the screen).
These actors have to appear when the player in the middle touches an other rotatable actor.
But which of these invisible object-actors becomes visible, needs to depend on which side of the rotatable actor was touched originally.

I have 2 questions regarding this:
1. How can I have the absolute top of the rotatable actor be differentiated from its relative top (If I number the sides of the rotatable square actor 1-2-3-4 and 1 is the absolute top (its head), when I rotate it 90 degrees clockwise, than the absolute top should remain 1 and the relative top (to the scene) should be side 2). Where and how do I specify this actor's top relative (to the scene 2) and absolute (its head 1)?
2.The reason I need the absolute top (head) to be identified is that depending on its orientation to the scene – 0 90 180 270 degrees I need that specific invisible actor to become visible after collision which is oriented 0 degrees relative to the absolute top (head) of the rotating actor. So if my rotating actor is right side up, the top invisible actor should become visible, but if my actor is on its side (90degrees CW) the one on the left should become visible, and if upside down the one on the bottom and so forth

Hope its not so difficult and you can help me
Thanks
Pete

Best Answer

Answers

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Without testing this, I would start here.

    A series of rules in the rotatable actor using magnitude and the rotation position. If you're using solid rotation positions then it would look like this. Actor is 100 x 100

    Rule for top

    When touch is pressed and game.mouse.position Y > self.position.Y + 75 and self.rotation is zero

    Rule for bottom

    When touch is pressed and game.mouse.position Y < self.position.Y -75 and self.rotation is zero

    Rule for left

    When touch is pressed and game.mouse.position X > self.position.Y - 75 and self.rotation is zero

    Rule for right


    When touch is pressed and game.mouse.position X > self.position.Y +75 and self.rotation is zero

    Not sure but you may have to swap X and Y offset based on the rotation position change if not then duplicate this series for all four rotation positions and then address the code you want to activate. This should get you thinking in the right direction.
  • PetCroPetCro Member Posts: 21
    Hi FryingBaconStudios,
    Many thanks for the quick answer :)
    But I would have an another question for the mentioned "problem".
    How can I address the code I want to activate? (so how can I make the hidden actors visible)?
    Thanks
    Pete
  • PetCroPetCro Member Posts: 21
    Thanks for your help :)
Sign In or Register to comment.