playMaker

Author Topic: Moving items in an array  (Read 509 times)

Mupp

  • Full Member
  • ***
  • Posts: 167
Moving items in an array
« on: September 07, 2021, 03:48:53 PM »
This is not about arraymaker.
How can I remove the last item in an array, move all the rest items down one step and add a new in the first slot without messing things up?
Also, do you always have to resize the array if you remove/add or is that done automatically?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Moving items in an array
« Reply #1 on: September 07, 2021, 06:28:47 PM »
Hi.
if you do this regular you should use array maker instead.

Array maker actually uses <Lists> and is better for something like this.

Wit array list you can do :
Array List Add (store Index)
Array List Move (index Mover from (stored Index), Index Move To (0)
Array List Remove At (stored Index)

In sequence

For array instead of doing Remove At use 'Array Delete At'
This way you should not need to do resize.

Mupp

  • Full Member
  • ***
  • Posts: 167
Re: Moving items in an array
« Reply #2 on: September 07, 2021, 07:44:49 PM »
Thanks, now I get the difference between the 2 array systems.

Problem, I can't find any action called move.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Moving items in an array
« Reply #3 on: September 08, 2021, 02:11:47 PM »
Hi.
Array List move should be in the array maker package.

Array move does not exist