Making an actor Jump when walking on Ceiling and Walls

delaesprielladelaespriella Member Posts: 2
edited November -1 in Working with GS (Mac)
Currently working on a game in which I am using acceleration to simulate gravity in different directions. I had no problems getting the actor to jump when the acceleration is down. Does anyone have any ideas on how I should go about getting the actor to jump when walking on the ceiling or the walls. Thanks in advance for your help.

This is a quick rundown of how I am jumping when on the floor.
When space bar is pressed
Change attribute - Self.motion.linear velocity Y = 300
With true/false on a self.jump attribute

Comments

  • KrakenCMTKrakenCMT Member Posts: 22
    Would you just be able to make the direction of the jump relative to the actor instead of the scene?
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    well you could make a rule when the player collides with the celeigng and attribute jump is true change self motion linear velocity y to -300

    that way when your on the ceilieing you jump the other way but jump normal when your supposed too

    you can also do the same for your side walls changing motion linear x to 300 and -300 depending on the right or left wall
  • delaesprielladelaespriella Member Posts: 2
    @John I tried that but it did not work. I'll have to try it again maybe I had something set wrong. Thanks.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    dont forget you need to switch the gravity when your on the celeing and sides, so youll probably need a attirubte for that. This is how i would do it for the regular jump and celeing jump

    Make your real attribute called jump, and make a interger attribute and call it playerorientation(or whatver you want) and set it to 0

    Now in your jump button have a rule when touch is pressed change attribute jump to true, then in the otherwise section of that rule put a change attribute behavior changing jump to false (so when you touch is changes to true then you let go it goes back to false)

    Make a rule in the ground actor when it collides with the player, change attribute playerorientation to 0
    Make a rule in the ceiling actor when it collides with the player, change attribute playerorientation to 1

    In the player have a rule when attirubte jump is true and attirbute playerorientation=0 change attribute self motion linear velocity y to 300

    Make another rule in the player when attribute jump is true and player orentation=1 change attribute self motion linear velcotiy y to -300

    then finally for your gravity have 2 rules in the player. The first one is when attirbutge playerorentation=0 accelerate down relative to scene

    Then the next rule is when attribute playerorientation=1 accelerate up relative to scene

    then it would be the same for the sides except changing your playerorientation attribute to new distinct numbers for the left and right side, and change motion linear x instead of y, and have your extra rules for gravity accelarting in the oppostie direction relative to scene
Sign In or Register to comment.