Set smaller collision area?

Danneman101Danneman101 Member Posts: 59
edited November -1 in Working with GS (Mac)
I've been searching the forum for a solution as how to resize the collision area relative to the object. These two threads seemed promising, but I came up on some problems with both of them. Any ideas?

"Finally change collision size? Anyone try this?"
http://gamesalad.com/forums/topic.php?id=8298&replies=3#post-223338

"Help with collision - explanation inside"
http://gamesalad.com/forums/topic.php?id=18290&replies=3#post-223348

Comments

  • old_kipperold_kipper Member Posts: 1,420
    Currently the collision area is set as the full rectangular size of an object or its narrowest dimension if you use a circular collision setting. This cannot be changed within the object (unless you resize the object size) but it is possible to use a secondary object of a different size, constrained and invisible, to set a different area for collisions.

    hope that helps

    kipper
  • LumpAppsLumpApps Member Posts: 2,881
    Ciao!

    There is another solution, it might help you but I do not know what you exactly want to achieve so it might not.

    actor1 and actor2:
    Constrain the X and Y of actor1 to game attributes named actor1x and actor1y/ (this is for example the player character)

    In actor 2 make a rule:
    All conditions valid
    Attribute position actor1x > self.position.x–32
    Attribute position actor1x < self.position.x+32
    Attribute position actor1y > self.position.y–32
    Attribute position actor1y < self.position.y+32
    And then do something...

    32 is just an example, it is size of the collision area / 2
    In this case the collision area is 64x64

    Actor 2 can be put on the stage as many times as you want it will still work.
    Let me know please if this helps.

    Cheers!
  • Danneman101Danneman101 Member Posts: 59
    Thank you both for your replies.

    Both your suggestions would work, I think, if the objects (actor1 & actor2) were not spawned in multitude (ie. several instances of both objects) as they are in my game.

    To clarify, in my case actor1 referes to all instances created from a single projectile "class", whereas actor2 refers to all instances created from a single target "class".

    If I understand this correctly, the first suggestion would require making a global (or "game") position variable for each target instance. This instance would constrain the variable, and in turn the corresponding image-instance would be constrained by this variable. With so many instances it seems very tedious to accomplish. And how would any of the projectile instances be able to identify the attribute of the target instances since the rules that check for attributes (as opposed to rules checking for actor received events) can't check for objects with a specific tag.

    And the same seems to go for the second suggestion.

    Or am I thinking about it the wrong way?
Sign In or Register to comment.