playMaker

Author Topic: Playmaker + ArrayMaker  (Read 1581 times)

wibble666

  • Playmaker Newbie
  • *
  • Posts: 4
Playmaker + ArrayMaker
« on: March 06, 2014, 04:47:01 PM »
Help !  , I'm trying to do something which i think should be really simple but its not working - i have a little race game with a car logging its lap time into an array list when it hits the start/finish line , what i want to do now is look through this array list each time a new lap is added and check its the smallest time in there, if so i want to print that new time on screen.

Any ideas people ?

blackant

  • Hero Member
  • *****
  • Posts: 521
  • http://blackantmaster.com
    • blackantmaster.com
Re: Playmaker + ArrayMaker
« Reply #1 on: March 07, 2014, 11:58:12 AM »
is it really important to keep them as array list, why not making different variables by laps ?

so after you can easily compare them

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Playmaker + ArrayMaker
« Reply #2 on: March 07, 2014, 12:40:09 PM »
hi,

 You can't predict the number of laps, so you can't create fsm variables during editor time, what if they do one too many lap?

 I think using arrayList makes perfect sense here.

 Keeping track of the best lap should be done at the end of each lap then it's easy:

User finished a lap, is it quicker than the bext lap? yes store this new lap as the best lap ( and store maybe the lap number as well) else carry on.

Does that make sense?

the other way is two always feed two arrayList with laps and only sort one, then you know the quickest lap is index 0 of the sorted arrayList and you can get it's index from the non sorted arrayList to know which lap it was.


bye,

 Jean