playMaker

Author Topic: Moving backwards or forwards in an array of letters[Solved]  (Read 2517 times)

colpolstudios

  • Sr. Member
  • ****
  • Posts: 365
Moving backwards or forwards in an array of letters[Solved]
« on: August 16, 2023, 04:15:17 PM »
I have a selector sprite that currently moves along a line of letters going from A-Z and includes a "dot", "space" and "end" using an Int variable to count what letter I'm currently on.

It starts at 0 for A and ends at 29, if I reach 30 Im repositioned back to 0 and the letter A.

The Int either adds or subtracts 1 to achieve this functionally.

What I would like to do is move through an array of my letters going backwards or forwards depending on the current value of the int variable. when you press the "Space" button an event would be sent "selection completed" and move to the next possible new selection.

It's an old style arcade type of letter AAA

Currently, I'm using three int switches and 81 states, and it works. But using an array I assume is the right way to go?

I am unsure how to go about creating the changes needed, maybe you can help?

« Last Edit: August 17, 2023, 04:02:46 PM by colpolstudios »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Moving backwards or forwards in an array of letters
« Reply #1 on: August 17, 2023, 07:55:24 AM »
81 states is a bit much I think

I made a quick Gif on a setup where player can also hold button to go to next/previous



I also Added the sample scene (attachment below)

colpolstudios

  • Sr. Member
  • ****
  • Posts: 365
Re: Moving backwards or forwards in an array of letters
« Reply #2 on: August 17, 2023, 04:01:44 PM »
Thank you so much your example really helped.

Here is a video of how I used your help:
« Last Edit: August 17, 2023, 05:00:13 PM by colpolstudios »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Moving backwards or forwards in an array of letters[Solved]
« Reply #3 on: August 21, 2023, 05:47:44 AM »
Hi.

its a bit different as what I was thinking of, did not know it would be a grid style selection.
For this you can even make it without arrays.
You could for example set the game object name to A,B,..,.,-
then use 'Ui Get Selected Game Object' and set a event to Object Changed Event.
on change, Get Game Object Name and set to the variable to show on screen.
and loop back to the state with 'Ui Get Selected Game Object'

colpolstudios

  • Sr. Member
  • ****
  • Posts: 365
Re: Moving backwards or forwards in an array of letters[Solved]
« Reply #4 on: September 06, 2023, 03:30:44 PM »
Hi.

its a bit different as what I was thinking of, did not know it would be a grid style selection.
For this you can even make it without arrays.
You could for example set the game object name to A,B,..,.,-
then use 'Ui Get Selected Game Object' and set a event to Object Changed Event.
on change, Get Game Object Name and set to the variable to show on screen.
and loop back to the state with 'Ui Get Selected Game Object'

I am using a sprite for all of the letters and moving a selector separate sprite along the grid, but thanks for the extra info.

colpolstudios

  • Sr. Member
  • ****
  • Posts: 365
Re: Moving backwards or forwards in an array of letters[Solved]
« Reply #5 on: October 03, 2023, 11:37:59 AM »
Issues: The Highscore never saves the changes to the names and scores. When played online.

I am using the Json save and Json load actions.

Works fine in the editor.

Play the game here: https://colpolstudios.itch.io/donkey-kong-fan-remake