Change all rows value at the same time? & cause lag

WeiyuWeiyu Member Posts: 216
edited April 2017 in Working with GS (Mac)

Hello everyone! I want to ask everyone two question regarding my game.

Q1.How to change all row or columns value into the same number at the same time?

For example:
If I touch" Button.A", I will change "game.table"'s all row into 1.

tableCellValue(game.table, 1, 1) = 1
tableCellValue(game.table, 2, 1) = 1
tableCellValue(game.table, 3, 1) = 1
....at the same time.

Q2. Which one may cause game lag? and which one will cause delay more than another?

If I have a two GS projects.
First project have one scene and 5 actors, but every actors have 100 behaviors.
(There are 500 behaviors in all)
↑↑↑↑ I got to know this project will cause 7s~9s delay by my test.

Second project have 50 scenes, each have 5 actors, and every actors only have 2 behaviors.
(There are 500 behaviors in all)


Could anyone give me some advice, please?
In regard to Q2, I don't know which one is better for me.
Thank you for answer.
:)

Comments

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

    Q1: Use the Loop Over Table behavior to change all of the row values in a single column.

    Q2: Honestly, if you have 500 behaviors you're doing something wrong. I know that sounds harsh but there's almost always a way to reduce that to something much more efficient. And when I say efficient, I don't just mean from a performance standpoint. More important to me is the idea of having to edit 500 behaviors to fix some little problem later. Maybe if you describe why you're using 500 behaviors, someone can suggest a simplification. I once converted a project file a client had that used several hundred rules to one that used less than a dozen. Math can do wonders!

    I'd also avoid 50 scenes if there's a way to combine them into one, for example.

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

  • WeiyuWeiyu Member Posts: 216
    edited April 2017

    @tatiang
    Thank you for answers! There are very helpful answers.

    :D :D :D :D :D

Sign In or Register to comment.