Possible to toggle/modify Max Speed attribute on the fly?

lordsprinkleslordsprinkles Member Posts: 19
edited November -1 in Working with GS (Mac)
Hi Guys,

I'm having trouble limiting how fast my character runs vs. how high he can jump. I want him to JUMP with a max velocity of 350 but RUN with a max velocity of 250. The problem I'm running into is that I can't get a Change Attribute function to toggle Max Speed (250) to 0 (off) or modify Max Speed to 350 from 250 when jumping to work. I'm not sure if I'm doing it wrong or the feature isn't supported.

http://imgur.com/RRHcc.jpg

Is there some way to do this other than toggling the Max Speed attributes?

I tried looking at the Expression Editor equation in the Jump section of the Wiki but I don't understand what the math is doing...

Thanks for any help.

Comments

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    I'm a little confused, why are you using the max speed attribute at all? Do you need it for something specific? Now, I've not dealt too much with character movement, it's all been pretty static, but I am working on a game where I have a character move and jump.

    For movement, I just have an accelerate rule in the direction I want to move. For jumping I have the same thing but at a different speed and under a timer. "For .1 seconds accelerate up at 1100."

    Would that work for something you're trying to do? or is it more complicated.
  • Fafnir312Fafnir312 Member Posts: 161
    I do something similar to mulcahy but I made an attribute maxXvelocity = 700. Then I check it when I apply my acceleration: if linear movement X < maxXvelocity then accelerate. This effectively keeps my player from running too fast.
  • lordsprinkleslordsprinkles Member Posts: 19
    Thanks Fafnir,

    That sounds like what I was looking for but I didn't know how to go about it.

    Mulchany,

    Accelerate at a speed of 700 is way too fast when the button is held down for more than a few seconds (the top speed is way too fast for what I'm doing) but the acceleration and deceleration speed is perfect. Just needed a way to limit the max velocity once the button is held down for a long period of time.
  • lordsprinkleslordsprinkles Member Posts: 19
    Not to be a bother, but would you happen to have a screenshot of the rule? I messed around with trying to duplicate what you did for a few hours last night but I couldn't get it to work :(.

    What type is the 700 value? Integer? Real?
    Where do you put the "linear movement X < maxXvelocity" rule? Is it attached to the Accelerate attribute only? Or in the main section of the rule, if Right keyboard is down, etc.?

    Thanks!
  • Fafnir312Fafnir312 Member Posts: 161
    Ah, let me go look at what I did. My "code" is a bit crazy, but I'll try to pull out the relevant parts.

    All right, here we are. I have some extra stuff in there and there's more that I'm not showing but you'll have to tweak for your own game.

    Here's how I set up my keys. This is just the "right" key:
    http://i3.photobucket.com/albums/y58/MattVG/Game Stuff/Key-Mapping-Right.jpg

    Here are my player's attributes:
    http://i3.photobucket.com/albums/y58/MattVG/Game Stuff/Player-Attributes.jpg

    Here's my right/left movement rule:
    http://i3.photobucket.com/albums/y58/MattVG/Game Stuff/Rule-Right-Accelerate.jpg

    Here's my jump rule:
    http://i3.photobucket.com/albums/y58/MattVG/Game Stuff/Rule-Jump.jpg

    I hope that's not too confusing and helps you figure out what you need to do.

    EDIT:
    Here's a simplified version of what I was talking about. Again, it's for the "right" key only.
    http://i3.photobucket.com/albums/y58/MattVG/Game Stuff/Picture2-1.png
  • lordsprinkleslordsprinkles Member Posts: 19
    Hey Fafnir, are you having any problems with the new 0.6 update? Our movement rules are similar, is your maxXvelocity being ignored? Seems like mine is for some reason.
  • Fafnir312Fafnir312 Member Posts: 161
    Nope. Everything works just fine.
Sign In or Register to comment.