Table Spawning Issue

TosanuTosanu Member, PRO Posts: 388

I'm trying to refine a behavior I made that creates a bullet pattern in a loop. Basically, I've created a table that advances a row every (tick) seconds, at which point the behavior reads the columns, which are arranged in this way: Angle 1, Speed 1, Angle 2, Speed 2, Angle 3, Speed 3, and so on.

I have set it up that as long as the angle column X =! zero, it triggers a projectile with angle and speed derived from the Angle X and Speed x Columns on that row. This allows, once I get this right, for more than one shot to be fired per tick due to the multiple columns of the Table.

However, there is an issue with getting it to spawn more than one object per Row automatically. I have an attribute that tracks what column it just read, and then advances to the next Angle column at the end of the spawning rule. But i cannot get it to redo the != 0 check without nesting the entire rule a second time inside the first after changing the attribute, and then a third time inside the second, and then a fourth, as many as there are a maximum number of shots possible per tick.

This seems sloppy and inefficient even though it works. Ideally, the rule would check a column, and if triggered, autoadvance the attribute, and check the next column pointed, and so on, without these nested rules. Otherwise I will have to completely alter the rule's structure if I want to change the maximum number of shots allowed per tick.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    One solution is to use the Release Candidate for Mac that has a Loop over Table behavior. You would place the rule inside of that behavior and it would re-evaluate the condition each time.

    Without that -- and I suspect since you're working with a PC you may not have access to a Mac -- you'd need to do something to reset the rule such as changing angle column x to zero briefly or changing a boolean that back and forth from false to true and placing the rule inside of that rule.

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

  • TosanuTosanu Member, PRO Posts: 388

    I tried the Boolean, but it doesnt retrigger the rule. Is it because the entire rule is inside an Every timer, perhaps?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited April 2014

    Perhaps but actually if you already have it inside of an every timer, it should trigger each time the timer runs. Can you post a screenshot of your rules?

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

  • TosanuTosanu Member, PRO Posts: 388


    A few notes due to cut offs. The first change attribute is a %(row count) to keep the table looping through rows.

    In the second page, the cut off ones are all Cell Value grabs, so they shouldnt effect the loop issue. The rule at the very bottom is the nested identical rule i mentioned that is the only way im making this work so far.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    It's a little hard to tell from your screenshot but if the bottom rule is inside of the timer, it WILL trigger every 0.2 seconds. You can verify this with a Log Debugging Statement.

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

  • TosanuTosanu Member, PRO Posts: 388
    edited April 2014

    Thats the thing. It needs to trigger more than just that. each .2 seconds represents one row in the Table. I have, at the moment, 8 columns in the table to allow each row to contain up to 4 projectile speed and angle files. But other than repeating the rule 3 times nested in the first one, I cannot get the table to display all of its elements. I need to find a way to make the rule repeat itself WITHIN each timer trigger until it reaches an empty column, in a way that if i change the table later to a max of 3, or 5, or 10 projectiles, that it will carry over.

    The reason for this is I want to be able to choose to spawn projectiles in the pattern simultaneously, to shoot spreads as well as singles.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Well, as I said before I'd recommend the Release Candidate but unless you have a Mac or use a service like MacInCloud, that may not be an option for you.

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

  • TosanuTosanu Member, PRO Posts: 388

    Pity. My current workaround just feels so inelegant

Sign In or Register to comment.