A few (more) problems for a budding developer [proximity] [area] [scroll]

Before I get too involved with my game, I want to know what the most efficient way to do what I'm doing is.

Basically I have a huge environment, and a character who is drag and drop. There is a sort of "datadex" on all the treasures/monsters/people that are encountered. The object of the game is to explore the world and fill up your dex.

So what I want to have is when my character is placed in the proximity of an actor, I want it to flip a boolean on my table, making the data entry change image and become clickable. (imagine a pokedex)

So what is the best way to go about creating a proximity switch? The roundabout way I have is to create an invisible actor the size of a screen, and constrain it's position to the position of the monster/treasure/whatever. Then the switch is activated when the main character is within view of whatever it is collecting data on. This seems like it's going to result in a lot of actors, and organizing all of them could be a huge pain (and it might end up taking up a lot of data, but I don't know yet)

I would also like to keep this topic around for further questions so I'm not clogging up the board with dumb stuff. If there's a vet out there who would like to keep an eye on me, I would totally appreciate it.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    You can use the magnitude() function on a rule in each actor the main character can encounter. If the magnitude is lower than some value you specify then change the table data accordingly.

    From the Cookbook:

    magnitude (Function)

    Finds the length of a line segment drawn directly from the origin 0,0 to the given point. You can also include an offset to find the length between two points - for example, magnitude(x-x',y-y'). Say you have one actor at 100,240 and another at 25,30. To find the distance between them, use magnitude(25-100,30-240).

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • EggnogpaintjobEggnogpaintjob Member, PRO Posts: 6
    Great! Thanks you two! As expected, this solution led me to a new problem!

    So when the main actor gets close to the actor of interest, a little jingle plays, an icon appears on the far right corner, and the boolean value of my data dex changes.

    However, it doesn't seem like I'm able to create a rule where if the table value is already true, that the game shouldn't play the jingle and display the icon.

    This also seems like I'm not going to be able to create a rule for the dex actors to become clickable when the table switches them to true.

    so long story short I need a way to create rules based on whether the booleans of my table are flipped, or I need to know a better way to go about creating my dex.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    You can't currently use a tableCellValue expressions on the left side of a rule (that's coming soon, though). The workaround is to assign the tableCellValue to an attribute first and then use that attribute in your rule condition.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • EggnogpaintjobEggnogpaintjob Member, PRO Posts: 6
    how soon is it coming? Within a month? Within 4 months? A year? It will take me a long time to draw/write/animate all my resource files as I just started the game. Is it worth just putting off until later? It seems like that would result in waaaay too many attributes, and be much harder to keep track of. Thanks again for keeping up with this topic!
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I've learned not to give exact answers to "how soon is it coming?" since I don't work for GameSalad -- except indirectly as a volunteer moderator -- but my guess would be 1-2 months away. Soonish. And @uptimistik is right, it's already in the nightly builds along with "Loop" and "Loop over table" which are two very handy behaviors for efficient coding and for dealing with tables.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.