Tables Question

Jeffm2Jeffm2 Member, PRO Posts: 142

All,
I am trying to develop a simple "class room management app" similar to ClassDojo but with much less functionality.
Basically the user would need to be able to add or subtract students. They would have their name and some random avatar graphic. On some screen the user would need to see the whole "class", click on a student and the add or subtract coins (or some reward ) to their record. Know there should be someway to handle this all in tables. (this all has to occur locally).
I getting hung up on if i should spawn actors based on "records" created in the table and how would i list all records on my classroom screen. and then how would clicking on making the association between the spawned actor and its "record" in the table.

so basically it would be like creating a player profile and then allowing the player to go in and edit it and at some point showing the list of players but instead of just a name there would also be an avatar as well as the "points" they have been awarded.

Any thoughts or insite is appreciated

Comments

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

    Spawn actors? No... just place all of the actors on the scene and then show/hide each one as needed.

    I'm not sure what you mean by "how would clicking on making the association between the spawned actor and its 'record' in the table'...? It seems like there's a word missing from that sentence. But what I'm guessing you're asking is how to associate a particular actor with a particular table row. Just give the actor a self attribute (integer) such as self.row. Then when displaying text from the table, use self.row in the expression. Set the value of self.row manually in each instance of the actor. You can see an example in the image below where I've left the display text visible on the "trash can" actor.

    I've done this with a word game I'm making for students and it retrieves all of their data either individually or as a whole class depending on the scene*.

    *The whole app was created in a single scene using camera positions to "change scenes."

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

  • Jeffm2Jeffm2 Member, PRO Posts: 142

    Thanks so much for the reply. Yes I was trying to figure out how to associate the actor with their record. So in your game, how would you add a player? So I guess in my app, I would want the user to be able to add a student. So would this then add a row to my table? And then how is that row associated with an actor? Am I making sense?

    This is sort of what I'm trying to emulate?

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

    I'm somewhat familiar with Class Dojo, being a teacher myself. And yes, to add a new student, you would add a new table row at the end of the table and then populate the columns with data.

    As I mentioned above, each of the actors that are in the grid in your screenshot would have a self attribute that determines their position. So the first would be 1, the second 2, etc. You then use that attribute to lookup data in the table by row.

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

  • Jeffm2Jeffm2 Member, PRO Posts: 142

    Ok. First let me thank you for taking the time and to apologize if I'm being thick. Let me walk through this as I understand it. So if I kept to one scene, I would have 3 sections. One with my "grid". This would consist of say 40 invisible actors with reference to rows from my table that don't yet exist. these would be shown when ever a row is created that matches the actors number. So there must be some "if the row exists" logic.

    There would be a details section that is "jumped" to when the actor from the grid is pressed and this would populate based on the row that matches the actor number. ( I think passing this to the details actor is where I get confused). This would also be where you could add your points to the student.

    Finally your add a student section would be where you put in student name and the create a new row. This would "turn on" the actor in the "grid".

    Any templates that show this kind of logic? Have I over complicated this. Any chance to purchase your app to peek at?

    In any case thanks so much already for all your help.

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

    @Jeffm2 That app is a labor of love for me. I've spent probably 60 hours on it so far... I lost track. My wife teaches kids who need simple word activities and I decided to make one into an app for her students. But anyway, I don't know if I'd sell it at this point as it's quite unfinished. And I don't know of templates but I think I can probably give you some insights here. And if it turns out having the app would be of help, we can discuss that via private message.

    I don't use any sort of "if the row exists" logic or "turn on" the actor logic except to say that I check to see if the row is blank. If the first column (cell) of the row is blank, then I change the actor's self.color.Alpha to 0 to hide it. I do that for each actor in the physical row of actors. So if I have four "fields" in my grid, then I would have four actors who each check that value. They also each have a column attribute (self.column) that contains their placement in the grid. So the first on the left would be 1, the second from the left would be 2, etc. They use that in every tableCellValue() expression to check or lookup data. Does that make sense?

    When I add a new student, I increase the student count by one or just use tableRowCount() to determine it. The actor that was checking for that row's column 1 data will now be shown because the value of that cell is no longer blank.

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

  • Jeffm2Jeffm2 Member, PRO Posts: 142

    Totally understand about the app. Are you using the table search to check for the blank row? So in your table you already have your rows, they just are blank?

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

    I went back and checked my project and part of what I told you isn't still the case. I had at one point set it up with individual actors for every row and column in the physical grid. But what I realized is that at some point I decided to recursively spawn the rows. So I have a single actor for each of the columns in the first row of data and then each of those spawns itself again below in the next row and on and on until enough rows are spawned. The condition for spawning is that the actor's row attribute is less than the max number of rows in the table. So if there are 2 rows of actors and 2 rows in the table, nothing happens. But once a new student gets added to the table so that there are 3 rows in the table, the actors in row 2 of the grid then spawn a new row of actors below them.

    If it sounds confusing, it is/was. Like I said, I spent a great deal of time figuring out the system and it's not always easy to explain.

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

  • Jeffm2Jeffm2 Member, PRO Posts: 142

    Hey I am slowly but surely understanding and getting through this. Wanted to share some screens with you. Thank you so much for all your help and patience.

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

    It's looking good! :)

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

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

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

Sign In or Register to comment.