Changing size problem

kjjohnkjjohn Member Posts: 7
edited November -1 in Working with GS (Mac)
This is a complicated problem I ran in to working with GS, and I'm convinced its some kind of bug, which I seem to be finding a lot of in GS lately.

In my game, I have an actor (numberBlock), which is dragged into a box (collectBox) by the user. numberBlock does not exist when the game starts, it is spawned once you click on another actor (blockSpawnPoint). Clicking on blockSpawnPoint allows you to spawn many numberBlocks. Once the numberBlock is dragged into the box (collectBox), an attribute (numberCount) is incremented. When a numberBlock is dragged out of collectBox, numberCount is decremented, so that numberCount will always show the number of numberBlocks overlapping collectBox. However, once the amount of numberBlocks inside of collectBox reaches five, there is no room left for another numberBlock in the box. Therefore, I set a rule that shrinks the size of numberBlock if it is overlapping collectBox, and numberCount equals five or greater. If these conditions are not true, numberBlock will grow back to its original size. My problem is that my game requires the numberBlocks to collide with each other, and the Change Size behavior does not change collision size. So instead, I just used Change Attribute behaviors to change the size attribute within the numberBlock actor, that way the collision size would change too. However, once I have five numberBlocks in collectBox, they start to increase and decrease in size over and over again, and numberCount goes up and down extremely fast, and eventually just stops at 0, even though there are still numberBlocks in the box. Anyone have any ideas how to fix this? I even tried using interpolate, but that did not work either.

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    There is a bug In GameSalad where Collisions are not detected properly while sizes are changing. So that is why it acts funny on you. Unfortunately you'll have to think up a different solution to the issue.
  • kjjohnkjjohn Member Posts: 7
    That isn't my problem. It is not an issue with collisions, read the post again. Sorry that it is a little confusing, but this problem is fairly complicated.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    No, the issue is collision detection. As soon as the size begins to change Your "box Area" no longer detects anything inside it (or Overlapping/colliding) . There for it switches them back to their normal size. This is why the Number Changes up and down rapidly and what is happening is it is running over an over faster and faster until it misses the event all together and leaves it at 0 thus it stops changing.

    Collision Detection does not always mean Bounce off. It includes overlap. And I fully believe it is your problem here. Unfortunately there is nothing you can do since GS must fix the bug first.
  • kjjohnkjjohn Member Posts: 7
    Oh, you meant overlapping when you said collision detection. Thank you for your response.

    Is there any workaround you can think of to perform this same action than would work?

    edit-could I delete the actor being dragged and spawn a new, smaller one, or would that mess up my drag and drop function?
Sign In or Register to comment.