Rectangle object workaround

xienixsxienixs Member Posts: 17
edited November -1 in Working with GS (Mac)
Oke here is the thing.

I have a motor rider: 2 wheels + frame+person

What I want to do is as followed:

Make the motor rider as an image that is only an image.
The two wheels should have 2 circular collision objects.
The frame will be a simple rectangle collision object
The driver and especially his head will probably be another collision object.

I'm using at the moment the tutorial of how to get different points when shooting at different locations on the object.

I don't want a fully explanation yet as I love to play around by myself. However what I want to know for now is one thing. Is it possible in GS?

I mean that the two wheel collision objects always... ALWAYS stay at that location of the image. Thus even if one wheel gets blocked the image or other objects should not move further. Something like a grouped object.

Also what I noticed is if I for example press Left on the keyboard to let the image rotate. The circles stay at the same X and Y position of the rectangle. Thus if the motor image is upside down the wheels are still at the bottom and not up in the air. Is it possible that they move with the image along?

Thanks a lot...!

Comments

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    This may work on the iPad or the iPhone4 with it's new processor, but you will need a ton of constrains to pull this off and that usually kills your framerate on older devices.
  • xienixsxienixs Member Posts: 17
    Oke i tried it in a simpler matter...

    http://www.jjkoehorst.com/wp-content/uploads/roation.png

    But as you can see in the picture it does not rotate with the object. Any ideas? I see what i can do about rotating about the central axis but so far I have not yet an idea to solve that :)

    *turned email notifications on*
  • xienixsxienixs Member Posts: 17
    Oke i think i might have an idea of how to solve it only the problem is that it only works in my head so far.

    When I have a rectangle collision object completely horizontal and the round circle somewhere above the middle point. When I rotate the rectangle object the values of the angle should change right? Is it not possible to coordinate this new angle to the circle object to relocate it. So that the circle always stays on top of the helmet.

    http://www.jjkoehorst.com/wp-content/uploads/roation.png

    As is shown in the first part of the picture...

    Because what i basically try to achieve. When the top of the motor image or the left or right side above the wheels hit a collision object the motor should be rest, destroyed, minus points or whatsoever. Only I don't get this trigger so far.
  • xienixsxienixs Member Posts: 17
    Any ideas or is this just not possible?
  • wayneh001wayneh001 Member Posts: 300
    Hi Xienixs.
    Could you break your 'biker sprite' up into individual items, then control them in GameSalad. You can constrain items to an offset point then track it's angle etc. I've uploaded a really basic example if it's any help.

    http://gamesalad.com/game/play/64562
  • quantumsheepquantumsheep Member Posts: 8,188
    *hugs Wayne*

    When can you make it down in July for another meet, fella? :D

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • xienixsxienixs Member Posts: 17
    Oke so this is how im going at the moment.

    Motorframe:
    Constrain attribute: self.Position.X >> To: game.XBodyLocation
    Constrain attribute: self.Position.X >> To: game.YBodyLocation

    MotorWB (Motor Wheel Back)
    Constrain attribute: game.XBodyLocation >> To: self.Position.X+150
    Constrain attribute: game.YBodyLocation >> To: self.Position.Y+90
    Collide actor of type: Ground 1

    MotorWF (Motor Wheel Front)
    Constrain attribute: game.XBodyLocation >> To: self.Position.X-150
    Constrain attribute: game.YBodyLocation >> To: self.Position.Y+90
    Collide actor of type: Ground 1

    The thing is now... the front wheel goes perfectly attached to the Motorframe.
    The rear wheel doesnt feel like attaching and ignores my constrain attributes completely...

    What might be wrong?

    For a reason I had to remove my front wheel for a second. And then the rear wheel attaches perfectly.. hmmm will be continued
  • xienixsxienixs Member Posts: 17
    Cant edit my previous post... pretty annoying though...

    Anyway... When I have one wheel in the scene editor it attaches to the main frame of my bike. When I add the second wheel to the scene it will attach to my bike but then the first wheel will not attach to the bike anymore... is this a bug? or do I need to do something else to fix this?
  • xienixsxienixs Member Posts: 17
    wayneh001 said:
    Hi Xienixs.
    Could you break your 'biker sprite' up into individual items, then control them in GameSalad. You can constrain items to an offset point then track it's angle etc. I've uploaded a really basic example if it's any help.

    http://gamesalad.com/game/play/64562

    This is exactly what I did as you can see 2 posts above here... But as I stated before only 1 item seems to be able to get the location of the "main frame bike" thus when I add the second wheel to the scene editor it will not connect.

    Quickly used the image from your demo as this might visualize things better then 2 circle objects and a square object that i am using at the moment.

    http://www.jjkoehorst.com/wp-content/uploads/Screen-shot-2010-06-24-at-16.35.50.png

    As you can see it does not link up besides the rear wheel then.
  • xienixsxienixs Member Posts: 17
    Replying to myself and to others again :P

    Oke i went back to the drawing board and found out that I should play around with 1 object the motordriver and bike as 1 figure. Then setup the collision by rotation.

    Thus if the bike is at 90-180-270 degrees and it hits the ground it should be destroyed. Now my final question in this topic is. How to destroy the object when it hits the ground at a range of 80-100 degrees? I tried min/max but could not find something called range(a,b)....
Sign In or Register to comment.