Change the allowed angle of movement for platform

  • Hello everyone,

    I am new to game programming so please do forgive my newbie question.

    How do I change the allowed angle of movement for my platform character? At default it looks close to 45 degrees for angle of climbing a solid. How do I change that?

    Thank you to anyone who is able t o share some knowledge with me <img src="smileys/smiley1.gif" border="0" align="middle" />

  • If I understand correctly you want to control which angle is considered a walkable slope and which angle is considered a wall.

    Unfortunately, there's no slope control in C2's platform behavior.

  • Yann thanks for your reply. Yup that's what I want to do. That's really too bad. I guess I will have to rethink my game concepts and designs.

    After some testing, it appears that the maximum angle of slope movement is indeed 45 degrees. Hopefully the good people of Construct 2 might consider an option for this in their next release.

  • Hi All

    Was wondering if a solution to this could be done by adding the bullet movement to the platform person have it disabled unless he collides with a sprite that is invisible meant to trigger the special angle movement then disable the bullet movement after the standard platform is reached perhaps another invisible trigger sprite to force this?

  • That's an interesting solution Games.

    I might be wrong, but if we do use the bullet movement for the character to climb the slope, won't the player lose control of the character during the climb? If we set the bullet movement to stop when the player presses a button, and the character is still halfway climbing up the platform, won't the character get stuck there?

  • rekjl

    Agreed there we would need to anticipate stopping in the middle.

    So with that in mind if we want the player to stop then bullet movement would halt till key pressed for a direction to go up or down....

    Perhaps a fun solution would be to force it to slide down if halted.

    Basicly the movement on a custom angled slope would be handled much in the same way as we code in ladders and ropes...

    Not only can you create custom movement for this but you could slow him down as the angle gets steeper. Giving the game some fresh dynamics. Throw a few rolling boulders or barrels etc. now we need to code in jumping for our custom movement.

    Again I am speaking only from a this is the way I might go with this. I am very new to CS2

  • Haha I am very new to construct 2 as well Games.

    I am poor in programming, so maybe someone else can confirm this, but your solution does make perfect sense in terms of the logic. Haha might take a lot of events to get it to work properly, but it is worth a try indeed! Thanks!

  • Found this game in Scirra's arcade and it has angles with movement that are not all 45 degree. So it can be done just needs custom movement to do.

    scirra.com/arcade/addicting-action-games/5562/the-axis-full

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for that link Games.

    I tried the game out, but it looks like the two slopes in there are both under the 45degrees mark.

    Actually, I am getting close to a solution. I use the on collision with the sloped platform as a trigger. Than check whether to see if the angle is between the angles I am looking for. And also to check if the correct key is pressed, I perform the sprite move at angle action. I set the angle to the same one as the platform, and + or - depending on the movement direction.

    It works well to certain extent. It moves only once, so I need to continue to press. I can't use the on key press down because it is a trigger and I already have one trigger with the collision detection.

    I am going to try the bullet option next. Hopefully I will be able to find a workaround to this.

  • rekjl

    Glad to see you are not giving up <img src="smileys/smiley1.gif" border="0" align="middle" />

    You may find it useful to use groups which can be activated and deactivated in the system actions this way you can use the same type of key press for two actions. Depending on which group is active.

  • Yahoo! I did it Yann and Games <img src="smileys/smiley36.gif" border="0" align="middle" />

    Haha I am not sure how efficient my coding is, but it does allow us to set the limit for climbable slopes for the player in the game.

    Hopefully it might be of help or use to someone.

    dropbox.com/s/tfljopcivdg28lm/test6.capx

  • rekjl Very good job. code looks sleek enough in my opinion.

  • Haha thanks Game. Really appreciate it!

    Just an update though, I learned about dt today so I implemented it. I changed the pixel speed to (the speed of my character movement)200*dt. It climbs at the same speed as on flat ground. Haha with this we can adjust it to make the character climb slopes at a slower pace.

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