Collision!

dade6dade6 Member Posts: 13
edited November -1 in Working with GS (Mac)
Hi everybody
Can I collide more complex form then a square or a circle?
Sorry for my bad English

Comments

  • BackUpAndDownBackUpAndDown Member Posts: 685
    I believe so... as long as the image doesn't have a background.
  • StusAppsStusApps Member, PRO Posts: 1,352
    No you can't. You could use multiple squares and circles to create a more complex collision object though. If the actor is static then that's easy, if moving it'll need constraining.
  • dade6dade6 Member Posts: 13
    Can you show me how?
  • StusAppsStusApps Member, PRO Posts: 1,352
    depends really what you want to do. Be specific with what you want and I'll suggest the best way how.
  • dade6dade6 Member Posts: 13
    I have a animated character armed with a sword, and i need to collide the sword with a enemy
  • StusAppsStusApps Member, PRO Posts: 1,352
    ok. sadly I don't have time to write it all out as you would enter it (perhaps the GS support people can do that ..... hello... hello?).

    but here is a brief synopsis of what to do:

    - First create an invisible rectangular actor.
    - Place it on the scene overlaying the sword of your main character
    - resize it and rotate to fit.
    - now double click it and check its x and y positions
    - then double click your characters x and y positions
    - work out how far apart they are and constrain the attributes self.position.x and y of the invisible rectangle to that of the main character + the difference between them worked out above. As the character moves it should now 'stick' in the right place.
    - then when whatever event triggers the sword swing is true create rules in the invisible rectangle to move to new positions and then back, this will take some trial and error to match the animation correctly. (Perhaps don't have the rectangle as invisible when setting this up, make it invisible afterwards).
    - make rules to destroy enemies when they collide with the rectangle. Even better add a rule that the rectangle must be in motion to destroy them.

    Sorry I can't write it all out or make a project, time is short at the moment. If this all makes no sense at all then perhaps try something a little simpler first.

    Stu
Sign In or Register to comment.