Spawning actors makes an attribute change value unexpectedly

gayanjgayanj Member Posts: 10
edited December 2013 in Working with GS (Mac)
I have setup my rules so that It continuously spawns actors. But as soon as an actor is spawned another attribute changes its value. I am not sure how that happens.

BTW how can I attach my project file so you guys know what I am talking about?

Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited December 2013
    Compress your project file into a .zip file and upload it to a file-sharing site such as Dropbox or Mediafire. Then post the link to it here.

    [The "Help Wanted" subforum is for PAID requests. I am moving this to Working with GameSalad.]

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

  • gayanjgayanj Member Posts: 10
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I have the file... which attribute are you referring to? And what value are you expecting it to have at what point and what value does it actually have at that point?

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

  • gayanjgayanj Member Posts: 10
    edited December 2013
    I'm referring to the isGrounded game attribute. When a block actor spawns even though the hero actor is on a block the attribute changes to false and this makes the hero attribute slide off the block. You can see it changing the value where I have setup a white color box below.
  • gayanjgayanj Member Posts: 10
    Also in the hero actor I have set up to display the number of the block it is on. This number changes to 0 when a block actor is spawaned.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    In your platform actor, you have a rule called "Change Jump Attribute" and in the Otherwise section you have a Change Attribute behavior that is changing the value of game.isGrounded to false. So as soon as a platform spawns (and isn't colliding with the hero actor) it changes the value to false.

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

  • gayanjgayanj Member Posts: 10
    edited December 2013
    Oh man! I see the problem. How can I keep the value from changing even if an actor spawns? Should I use another attribute to keep track if a collision has happened?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited December 2013
    I haven't spent too much time on your file but I think you should put the collision rule in the hero actor rather than in the platform actor. Or at least move the Otherwise section to a rule in the hero. That way the hero actor determines when to change the value of that attribute.

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

  • gayanjgayanj Member Posts: 10
    @tatiang I did that and now my problem is keeping the hero actor moving with the platform. Now the hero actor keeps jumping off the platforms as soon as it collides with it. I think there is something wrong with how the offset of X is calculated. Is there any other way to do this rather that calculating the offset alone? I am using a table to store the X position of the platforms as they are created. This is because the offset has to be calculated dynamically when the hero actor collides with a specific platform.

    This is the link to the edited file.
    https://www.dropbox.com/s/9d3psy3bun5bby4/App.zip

    Thank you.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I'm not sure... maybe someone else will have some insights.

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

Sign In or Register to comment.