counter of meters

saadaoui59saadaoui59 Member Posts: 13
hello everybody
so i have a question:how to put a counter of meters?
thank you

Answers

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    I think we will need more info then that.
  • saadaoui59saadaoui59 Member Posts: 13
    I want to count the number of meters that my player does in my game
  • MantoManto Member Posts: 796
    I made you a simple meter counter using the Cannon Physics template. Download
  • saadaoui59saadaoui59 Member Posts: 13
    thank you
  • simo103simo103 Member, PRO Posts: 1,331
    @saadaoui59 ... I think codemonkey did a number of ways to measure distance in a demo template a long time ago. I have it available for download on the right side of this page:
    http://www.funkymunkygames.com/GameSalad/search/

    It's the 'distance moved' one.
  • KnightStarKnightStar Member Posts: 162

    Anyone know if that demo that @codemonkey did is still around? I could use a means to measure distance for a game using a scene-wrapping background..

    thanks!

    -- J

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited April 2014

    @KnightStar Something to think about is what distance actually means in a game and with GameSalad. If your background is scrolling, then it is scrolling at a certain speed. Decide what formula you want to use (for example: meters=background distance in pixels divided by 10; or meters=time in seconds multiplied by 50) and then work on the math or ask questions based on a specific wording of your formula.

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

  • KnightStarKnightStar Member Posts: 162

    @Tatiang - Thanks for the insight.. I haven't started thinking about the math just yet as I wanted to see something in action before grinding away. (dunno why, but I tend to a be a visual developer in which I work better by seeing an example, etc. and adjusting accordingly to fit my needs)

    That said, the concept I'm looking at is essentially the same as the Shot-Put or Hammer-Throw track & field events, in which after an interactive wind-up (e.g. tapping buttons, etc.), the objects hurdles upwards and then downwards on the screen as the background images scrolls along. The background will slowly slow down as the object decelerates and lands (bounces along) on the ground before coming to a stop.

    I don't think I can use meters=time, since there will be an obvious acceleration and then deceleration from when the object is launched and then slowly bounces to a stop.

    -- J

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited April 2014

    @KnightStar Oh man, I worked on a side-scrolling golf game for ages (probably 100 hours, no kidding) and it became so complex that I gave up on it... for now. It was also one of the first apps I designed so I was very adept at keeping things efficient and clear. Anyway, your description sounds like exactly what I designed. You're right that you can't use time. In that case -- and my golf game works this way -- you just constrain the number of meters to the hammer's (self.position.X-self.position.StartingX)/[some factor]. So if the hammer has traveled from x=100 to x=700, then the difference is 600. If you decide you want that to equal 200 meters, then your factor is 3 and you divide 600 by 3 to get 200. Following that example, if you then throw the hammer from x=100 to x=600, it would equal 167 meters because (600-100)/3=167.

    Well, I just gave a visual learner a written explanation... some teacher I am! :wink:

    I'll send you a video of the golf game so you can see it. I don't think I've ever shared it on the forums because I still want to publish it.

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

Sign In or Register to comment.