0 Favourites

How do I rotate character around a square (pics for details)

  • I've been doing this game i always wanted to make since i was small, so far im up to level 5 of the game (out of 9) and it's amazing, construct 2 is the best {Thumbs Up} But im having an issue atm with this: (pic describes best)

    IMAGE: sorry cant upload it i'll just paste the thing separated, if that still isnt allowed i'll just describe more detailed and hope you guys get it

    http : // postimg . org / image / ikfzie51p /

    What im having trouble with is telling the game when the character (that is a box more or less, thus has only 4 points) is switching sides of the ground ( which is like another bigger box lol )

    i was thinking of changing the gravity to 90 when touching the top part, 180, 270, 0 on the others but im blocked, the character falls off the box/ground before touching the other sprite/part of the box in order for the action to occur... hence this thread!

    please help me, if you could, oh mighty gods!

  • maybe this will help:

    Subscribe to Construct videos now
  • Hey man thanks for the reply and the tutorial link, that was good stuff, but in the video he is using a round object as ground, while i want a square to act as a solid ground with different gravity degrees on each side (on top have 90 degrees, on other side have 180 and so on)

    I think that the tutorial you gave me was close to what i needed but not exactly, do you perhaps have any other ideas?

  • Here I just threw this together really quick. Let me know if its what you were looking for. Should help you get started. Let me know if you have any questions.

  • Yes, could you post pictures of the example because i am at work at the moment and can't load the file and see it from this pc

    thanks anyway, i hope it's what i need

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • got my brother to turn on my pc and try the thing and tell me what the result was, he is helping me with the project, and he told me that looking at the code it seems to do what it should but it doesnt work with a square, because you fall off the edge before switching the degrees of the gravity, in your example you're using an L shaped thing, which works because you dont have to "free fall" in order to touch the other sprite, on a square it is different because you have to somehow rotate at the edge in order to change gravity i suppose you could use an invisible sprite on the edge to tell the character to rotate to the other side of the square and then on touching the sprite of that side the character would get its degrees of gravity, but i wouldnt know how to do that!

    anyway thanks for all the support, i hope we can come up with something

  • ok thatserafimkid i edited what you sent me and here's what it should look like.

    http : //postimg . org/image/84cjq3m7p/

    i tried adding 2 invisible sprites at the edges to rotate the char but, although that works, the chances of him falling are really high, you have to actually keep pressing a key towards the center of the square in order for him not to fall off during the switch of sides, which is something i'd like the player not to worry about!

    any ideas?

  • Bump, is this impossible? &.&

  • Here, this should get you going in the right path. Just a tip use thatserafimkid , or who ever you are speaking to so they get a notification that you replied to them,

  • Here, this should get you going in the right path. Just a tip use thatserafimkid , or who ever you are speaking to so they get a notification that you replied to them,

    thatserafimkid man you are a mad genius, really, that is EXACTLY what i had in mind!

    I don't want to just copy/paste the code tho, it would be nice if you could explain alittle bit what you did!

    Out of all the commands you used here's the ones i am unfamiliar with or just have questions about (if you want to answer them that is lol)

    (starting from top to bottom of code)

    Inside Marker : Sprite2.ImagePointX(1) and Sprite2.ImagePointY(1) what is image point referring to?

    Also, is the inside marker needed of is it for details? (from what im understanding it's just a nose, a very well programmed one lol)

    on the left marker / right marker overlapping x: Self.Angle +10 where do you find this code, as in is there a page i can find specific codes like Self.Angle you used? (it seems rather interesting and expands the possibilities)

    Sorry if im wasting your time, but you just blew me away with how well this is executed!(and fast too)

    Side note: when jumping from the top part towards the edge and passing it, it is expected to fall on the other side just like when you walk there, instead the char falls off the map without attaching successfully to the other sprite (test by going right and jumping, you can see he falls instead of rotating and changing his gravit towards the sprite beneath it)

    I'm going to try and figure it out on my own, im thinking of using some sort of invisible wire to tell when the char is jumping and doing that specific jump that bugs the mechanism and makes it fall off the sprites and once triggered it will rotate the char just like on the ground

    i'll post some updates if i ever do manage to haha (hope this is as easy as it sounds)

  • The image point so I can position the inside marker at the edge of the character. The InsideMarker is not a nose lol, Its needed to test collision when doing an inside corner rotate. All three markers can be set invisible and it will run the same.

    Self is just an easier way to refer to current object your giving commands to. Rather then write Sprite2.Angle I can do Self.Angle if my condition already refers to the object.

    The Angle is just an expression of the sprite object.

    Do a little reading in the manual about objects and expressions to get yourself familiarized.

    Try this for the jumping off the ledge problem.

    The purple half circle are what I call the gravity field. By increasing the size of those you can change how far your character can jump while still getting sucked down to the platform. Those can be set invisible. Easier to see the effect when they are visible.

  • The image point so I can position the inside marker at the edge of the character. The InsideMarker is not a nose lol, Its needed to test collision when doing an inside corner rotate. All three markers can be set invisible and it will run the same.

    Self is just an easier way to refer to current object your giving commands to. Rather then write Sprite2.Angle I can do Self.Angle if my condition already refers to the object.

    The Angle is just an expression of the sprite object.

    Do a little reading in the manual about objects and expressions to get yourself familiarized.

    Try this for the jumping off the ledge problem.

    The purple half circle are what I call the gravity field. By increasing the size of those you can change how far your character can jump while still getting sucked down to the platform. Those can be set invisible. Easier to see the effect when they are visible.

    Cool, this new way of doing it works amazingly well, the gravity field is much simpler against what i had in mind ( was thinking of stretching the left and right markers when the chr jumped, adding each pixed of jump to the height of both the "legs" and this way he would "walk" while jumping) But i guess this way is mush more simpler to do, thanks man you made my day

    And yeah, it wasn't just a nose after all lol

  • You're welcome. Good luck expanding on it. Can't wait to see what your game looks like. Just reuse the gravity shields. each direction has a separate ID that correlates to the direction. So as long as you copy the right direction you can use it on any platform. The inside corners is the only tricky bit. You'll have to give your platforms ID like I did. You can probably put all your platforms in a Family and give them a Family instance variable ID. You'll have to add the code for the inside top left, bottom, left, and bottom right. Right now I have top right in the code. So you can figure it out from there.

    Let me know if you get stuck at any point and I can always help you.

  • thatserafimkid hey man i did all you said and the way it turned out is so epic i cant believe this is even real haha, going to add this mechanism to the remaining levels it is going to kick butt!

  • Yesterday I was goofing around with it, and I was able to have the player's gravity set to the gravity field angle instead of testing for the id. Now you can have diagonal platforms and it will still work. Check the new capx.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)