Simulate a race result with arrays?

Get help using Construct 2

Post » Wed Nov 23, 2016 2:23 pm

Hey folks,

I'm developing a racing manager game right now.

But now I just have some trouble in simulating a race (without visual just result)

This is what I got:

ArrayTeam

Code: Select all
           Team1     Team2
Name       team1     team2
Car          80        74


ArrayDrivers

Code: Select all
           Driver1     Driver2     Driver3    Driver4
Name        alex       daniel      kevin      niko
Skill       65         70          84         61
onteam      team2      team1      team2       team1


Now I wanted to simulate a race mixing the car performance and the driver skill (Plus a random given tolerance by +/- 10% for every car and driver. That way I would get some random rankings). After that I wanted to show a a result text screen with every driver gets points for the position they ended up with (1st gets 25 Points, 2nd gets 18 and so on).

My english is not the best. Hope anyone can help me out with it!

Regards,
Kraudi
Working on "EVERBLAST"
Image
B
30
S
6
Posts: 219
Reputation: 2,808

Post » Thu Nov 24, 2016 6:00 am

No one with some array knowledge out there? :D

Can't figure it out... :shock:
Working on "EVERBLAST"
Image
B
30
S
6
Posts: 219
Reputation: 2,808

Post » Thu Nov 24, 2016 10:24 pm

I've got something to work but now I still have some
problems.

Image

I sorted the array but sometimes some names are shown duplicated and sometimes it works great.
Dont know why this happens. Anyone has some experience with it?
Working on "EVERBLAST"
Image
B
30
S
6
Posts: 219
Reputation: 2,808

Post » Fri Nov 25, 2016 8:11 am

RaceArray.capx

edit: ...fixed capx...I hope...
Image
B
63
S
23
G
7
Posts: 1,480
Reputation: 10,796

Post » Fri Nov 25, 2016 8:34 am

korbaach wrote:RaceArray.capx

edit: ...fixed capx...I hope...


Wow! Thank you very much! Exactly what I was trying to do. I'll try to integrate it into my project.

Looks like I have to read some array stuff to get more comfortable with!
Just one question. I wanted to add a drivers and team standings into the app. Can I easily add the won points to the Drivers and Teams Array?


Thank you!
Working on "EVERBLAST"
Image
B
30
S
6
Posts: 219
Reputation: 2,808

Post » Fri Nov 25, 2016 9:14 am

Kraudi wrote:I wanted to add a drivers and team standings into the app. Can I easily add the won points to the Drivers and Teams Array?


Of course.. just give me some time to figure out the easiest way...probably another array or two :)
Image
B
63
S
23
G
7
Posts: 1,480
Reputation: 10,796

Post » Fri Nov 25, 2016 9:16 am

korbaach wrote:
Kraudi wrote:I wanted to add a drivers and team standings into the app. Can I easily add the won points to the Drivers and Teams Array?


Of course.. just give me some time to figure out the easiest way...probably another array or two :)


Wow cool! SOunds great. Thought the same about a new array. One for DriverStandings and one for TeamtStandigns maybe?

Edit: I've seen you integrated possible crashes. That is an awesome little feature. I really like this. Just tested it and seen that the crashed drivers have no name on the classement (I think because you delete the whole line). Is it possible to set the crashed drivers to the end of the standigns and instead of points give out a text like "DNF"? That would be awesome :D Because then I could extend this myself to technical car failures also.

Sorry for the bunch of questions. I just try to understand the way you are doing this nice capx :D
Working on "EVERBLAST"
Image
B
30
S
6
Posts: 219
Reputation: 2,808

Post » Fri Nov 25, 2016 10:51 am

To display the crash : Capx modified
Use a specific index value, use a function to display the score, allow to navigate between the different result page (20 racers for 12 results only displayed).
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
284
S
109
G
91
Posts: 7,317
Reputation: 87,483

Post » Fri Nov 25, 2016 11:00 am

Kyatric wrote:To display the crash : Capx modified
Use a specific index value, use a function to display the score, allow to navigate between the different result page (20 racers for 12 results only displayed).


Ah now I understand. Thanks for the excellent addition!

I also extended the standings to display all 20 on one page. But your way is also very cool if you have more drivers.

Thank you very much for your time! Well done.
Now I only need to get the driver standings and team standings to work :) Maybe korbaach comes up with a good way :)
Working on "EVERBLAST"
Image
B
30
S
6
Posts: 219
Reputation: 2,808

Post » Fri Nov 25, 2016 1:46 pm

@Kraudi please check function "printRank" ..
I'm not sure that gives correct results..and really do not have time..


race2Array.capx
Image
B
63
S
23
G
7
Posts: 1,480
Reputation: 10,796

Next

Return to How do I....?

Who is online

Users browsing this forum: Magistross, mtnboy22, Rable and 6 guests