Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Help with Types - Array of Types not updating?

Author
Message
Supertino
6
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 2nd Jul 2017 22:30
When I run the KillEveryone() function I expectthe three victims in myKillList array to update their dead variable but they all remain as zero?!

blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 2nd Jul 2017 22:50
When you inset the value into the array it makes a copy of the variable.
Supertino
6
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 2nd Jul 2017 23:08
Okay i see, any work arounds for what I am trying to do?
hendron
8
Years of Service
User Offline
Joined: 20th Dec 2015
Location:
Posted: 2nd Jul 2017 23:32 Edited at: 2nd Jul 2017 23:33
You'd need to access them by array index instead of trying to access them by reference. You could write a function that inserts an element into the array and returns the index, and another one to check dead status.

Supertino
6
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 3rd Jul 2017 21:35
okay I got it thanks for the example.

Login to post a reply

Server time is: 2024-04-27 04:37:02
Your offset time is: 2024-04-27 04:37:02