how do I create a skier going down the slope

0 favourites
  • 9 posts
From the Asset Store
The ultimate voice pack filled with 1,536 files of .......wav and mp3 of individual numbers, letters, and words (that go
  • Hello,

    I am trying to make my guy do down a ski slope. I have implemented basic stuff that is functional up to this point, but now I would like to refine my work and have no idea how.

    Here is the capx:

    dl.dropboxusercontent.com/u/17261636/SkiInstructor.capx

    So the guy goes down (90 degrees angle for the bullet behaviour) by default or when you press arrow down. If you press left or right on the keyboard he goes left or right (the bullet angle of movement is modified in increments of 35 degrees). What I would like to do is have the guy rotate but not so fluidly - I mean you press left and he goes 35 degrees left, then wait a fraction of a second then move another 35 degrees - I would like to obtain small breaks in between the movements.

    I tried with the wait command but it didn't help.

    Any support or advice would be greatly appreciated.

  • Set up a variable so that hero can only move left and right when the variable is set to 1. When hero presses left, set the variable to 0 and wait a number of seconds before setting the variable back to 1. This should shut out the ability to move in any direction until the timer has finished.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks! It worked!

  • Ok now I ran into another problem that I can't find any logic answer to. Here it is: I want my guy to increase speed when going straight down the ski slope. I implemented this like so:

    • if hero bullet angle is 90 degrees increase acceleration for the hero bullet to 10 else change acceleration to 0

    Now when the layout begins this works. If I change the direction the speed stops increasing. My problem is that if I come back to 90 degrees (straight down) the speed only increases on two conditions:

    -when changing the angle of movement from right to left and holding the key down (if I shortly press the key the acceleration doesn't increase)

    -when changing the angle of movement by pressing the down key (which automatically sets the angle to 90 degrees)

    I don't understand the logic, this looks like a bug to me... If anyone understands please explain this to me.

  • Specter1981

    Isn't that just because the skier starts the game at 90deg and then to return to 90deg you need to press down? Not sure what the issue is here. If you still think there's an issue please link to .capx

  • The latest version of the capx is linked into the original post of this thread. I will also add it again here:

    dl.dropboxusercontent.com/u/17261636/SkiInstructor.capx

    There are three controls - left, down and right. Left and right substract or add 35 degrees to the skier's bullet angle, down sets the angle to 90 degrees.

    The skier starts at a 90 degree angle, going straight down.

    Press right from the starting position and you have two possible positions: 55 or 20 degrees (then the skier is blocked)

    Press left from the starting position and you have two possible positions: 125 or 160 degrees (then the skier is blocked)

    Now I want a new mechanic - when the angle is 90 degrees, I want the bullet acceleration to be set to 10 so the speed will gradually increase. This works but only partially:

    -on layout start --> OK

    -if I move the skier left or right acceleration goes to 0 --> OK

    -if I press down and the angle is set to 90 degrees acceleration goes to 10 --> OK

    -if I am at 55 or 20 degrees (so sliding right) and press left until I get to 90 degrees the acceleration goes from 0 to 10 --> OK, but not always - if, for example, I was sliding left at 125 degrees and press right twice (so the angle is 90 - 55) then move left once (so the angle is 90 then the acceleration no longer goes to 10 (or it does but only sometimes)

    -if I am at 160 125 degrees (so sliding left) and press right until I get to 90 degrees the acceleration stays at 0 --> NOK, I wanted the acceleration to always go up

    I am not sure what I am doing wrong here or why it's acting like this, it makes no sense...

  • Specter1981

    can be fixed by changing line 14 to be between 89 and 91 instead of =90.

  • Hey plinkie, thanks again. Could you please explain the logic behind it? Why it works like this and it didn't with =90?

  • Specter1981

    I was anticipating this question haha, and honestly I'm not sure. less than 91 works fine, greater than 89 works fine. between the two values works fine. It's some glitch related to some of the logic you set up elsewhere I think. Seems to work fine when you test it with setaccel to 10 when angleofmotion=160 etc. I am too busy to investigate it at the moment but that is a nice workaround :)

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