Speed-Pedal

MarcoColMarcoCol Member, PRO Posts: 279
Hi,
I want to add in my driving game a speed pedal.
I add something, but currently the player can only choose the upper or lower half of the pedal to drive forward or back. That works good, but I now see, that most of the players want to move the pedal forward or back. There should be only 2 values: forward =0 or 1, back = 0 or 1
My first thinking was to move an actor only in Y in antoher area, and when overlap/touching two other other areas (one high and one lower) then the value change.
But is there an easier methode?

Cheers, Marco

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    How about a screenshot? I can't tell if you have a pedal that moves up and down or left to right or...?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • MarcoColMarcoCol Member, PRO Posts: 279
    Oh yes. attached you find the three positions.
    The player should slide them. From middle to top or down. or directly from top to down and down to up.
    And the values only should be:
    forward=1 / back=0 (for driving forward)
    forward=0 / back=0 (for stand)
    forward=0 / back=1 (for driving backward)
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited May 2013
    So not really a pedal but more a gearshift. Now it makes sense. If you want them to be able to swipe to move the lever up or down, you can learn to do so from this video:



    You'd just change the image based on the swipe (if the image is "bottom" and they swipe up, change the image to "middle". If the image is "middle" and they swipe up, change the image to "top", etc.).

    Or... if you want a really simple method, just do:

    When touch is pressed AND game.mouse.position.Y [is between the middle and bottom edge of the actor] --> change image to "bottom" etc...

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • MarcoColMarcoCol Member, PRO Posts: 279
    Oh, thank you. I will have a closer look on that in the next days.

    Cheers
  • MarcoColMarcoCol Member, PRO Posts: 279
    @tatiang:
    I've tried now a lot of and I can say, that without the middle positions, it works without problems and good as it should.
    But I can't get it working, with the middle-step.

    I put everything in one actor (but I should, that's not the problem).
    I tried that without graphics, only with text feedbacks...

    Then the main touching-rule in the actor, which works is:
    Direction = 0

    If Touch is released AND Release > Touch
    change att Direction to 1

    If Touch is released AND Release < Touch
    change att Direction to 2

    Which doesn't work is:

    If Touch is released AND Release > Touch AND Direction = 2
    change att Direction to 0

    If Touch is released AND Release < Touch AND Direction = 1
    change att Direction to 0

    Where is my error?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Can you post a screenshot of your rules or a link to download your file (you can PM it to me)? I think I understand what you're doing but "Release" and "Touch" doesn't really tell me enough...

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • MarcoColMarcoCol Member, PRO Posts: 279
    Sure.
    I have those three attributes.
    Then the big one are the four rules. The middle both are turned of for a test, but when I switch them on, it doesn't work.
    Then the main functions. I set both mouse to Y - not to X as in the video example.
    and the three feedbacks - when they run, I can change them with graphics...
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Those rules look right and should allow the player to switch from gear 0 to gear 1 and from gear 0 to gear 2, but not from gear 1 to anything else nor from gear 2 to anything else.

    I'm not sure what the problem is that you're experiencing. If you'd like, you can .zip the project file and send me a link to download it.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • MarcoColMarcoCol Member, PRO Posts: 279
    Oh, i will add the rules which are missing. Maybe than it works...
  • MarcoColMarcoCol Member, PRO Posts: 279
    I have again a look on it.
    I switch the both rules to "on" where the player switch from 1 to 0 and from 2 to 0.

    But nothing changes.
    I can switch from standard (0) to 1 (up) or 2 (down). After then, the switch is directly again from 1 to 2 or 2 to 1 - without stopping at 0 (middle). But my rules say that it must go from 1 to 0, from 0 to 1or2 and from 2 to 0.
    I didn't know whay it doesn't work.

    It's a very huge project, I can't mail/zip.
  • MarcoColMarcoCol Member, PRO Posts: 279
    I find the mistake!
    I add in each rule (after changing the gear.direction) the change att of the touch and release pedal to 0.
    I thought it was set automatically, but that wasn't done. So it works now!
    Thanks Tatiang!
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    @MarcoCol You're welcome. Glad you solved it!

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • MarcoColMarcoCol Member, PRO Posts: 279
    Hi Tatiang,

    two weeks ago, I solve the main problem and it works find.
    So this pedal is for get speed for forward or back.
    So there are two more buttons on the HUD for drive left and right.
    If I touch one of them with one finger of my right hand, then want to drive forward (so I touch with the finger of my left hand down of the pedal, move up and release), then the pedal moves down (not up!) and the actor moves back. Same when I move the finger down, then the actor moves forward and the pedal moves up (not down)!.
    It works fine, if I don't touch the right/left actor, or when I touch the right/left actor after start driving forward/back.
    Did you have an idea?
  • MarcoColMarcoCol Member, PRO Posts: 279
    It seems, the problem occurs, if I touch for example with the right finger on approx the Y at about 100 and start touch with the left finger on about Y 50, move to about Y 150 and release then.
    If I for example start with left finger on about Y30 and release at about Y80, then, nothing happens. No move forward or back!
Sign In or Register to comment.