playMaker

Author Topic: Lists and Arrays  (Read 792 times)

curb47

  • Sr. Member
  • ****
  • Posts: 256
Lists and Arrays
« on: February 08, 2021, 02:07:48 AM »
Hiya,

I've been reading about Lists, compared to Arrays and think that Lists might suit my needs better.

From what I understand,  Lists are dynamic and it's easier to add/remove variables/objects without causing fiddly complications.

With Arraymaker , the actions are 'Array List ', which got me wondering, are they Arrays, or Lists? I'm figuring they're Arrays.

Is there an equivalent set of actions for Lists? Like, can I set up Lists, as easily as Arrays, using a different group of actions that I haven't discovered yet?

Thanks,

J.
« Last Edit: February 08, 2021, 04:44:09 AM by curb47 »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Lists and Arrays
« Reply #1 on: February 08, 2021, 02:27:52 AM »
The built-in Array type in PlayMaker is a hybrid of an Array and a List. The Array actions include many things you would normally do with a list. Honestly, the type could just as easily have been called List.

ArrayMaker does have some more functionality but requires a few more steps to set up and use.

I would start with the built-in Array type and investigate ArrayMaker if it looks like it does some stuff you need. And post here when you run into that so we can look at adding it to the built-in array type.

curb47

  • Sr. Member
  • ****
  • Posts: 256
Re: Lists and Arrays
« Reply #2 on: February 08, 2021, 09:28:48 AM »
Hi Alex,

Good to hear from you. Thank you for Playmaker, it's a wonderful experience.

I have Arraymaker, and have been using it, but my array set ups and logic are all fairly rudimentary and simple.

I posted another thread about my 'problem' , but essentially, I have an array list consisting of up to 20 game objects (enemy drones), and there are 2 events that can be sent to all the objects on the array: target Mother Ship and target Player Ship.
However, the enemies can be destroyed, of course, so I'd like to remove them from the list so they no longer receive either of the Send Events.

However, it's this removal form the list that creates a glitch, in that, sometimes the objects are being given the Send Event, whilst being shot at and destroyed the the list changes rapidly.

djaydino helped me out before, and I have a system in place that kinda works, but there are holes in the logic here and there.

I concluded I should set up an array for the initial spawn, and another array for when an object is killed, so all the objects exist dead or alive on the first array and only dead objects exist on the 2nd array, then I just have to work out how extrapolate form that, the objects that are 'alive' and send the events to only those.

I think.

?

Thanks again.

J.