My weeks been balls!! Help me cheer up!

tollhousestudiotollhousestudio Member Posts: 166
edited November -1 in Working with GS (Mac)
With some tasty gaming with GameSalad! :)

Actually I was just wondering, I'm playing with the physics in GS and have to say, its sooooo much fun. But i've not made a game with it yet.

What I'm trying to do is:

e.g. have a pile of movable boxes and if I throw a grenade at them they will move appropriately with the explosions direction.
So if the grenade landed in the middle of a pile of boxes, they would fly out in a sort of circular direction?

Is that easy enough to do?

Cheeeeeeeeeeers!!!!

Comments

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    You'll want to use two things in the expression editor. VectorToAngle and magnitude. If you constrain two game integer attributes to the bomb's X and Y you can use these in the block actor to get the angle. If you create a variable within the block (self attribute not game) and constrain it to VectorToAngle(game.bombX-self.positionX, game.bombY-selfpositionY) the self.attribute will constantly find the angle between the two. Then have an accelerate behavior within some sort of trigger rule (touch or timer maybe) and in the angle for the accelerate behavior use the self attribute that is constrained with the VectorToAngle + 180 (I think - to make it go the opposite direction Away from the bomb). The other thing I would do with in the block actor is create a second self attribute and use magnitude. Magnitude just figures out the distance in pixels between two points. Set it up exactly like the vectorToAngle. Use this (possibly multiplied or divided by some constant to get the right feel) in the accelerate behavior's speed. The idea is that the closer you are to the bomb the greater the effect of the explosion. you'll need to play around with the constants to get it to feel right.
  • tollhousestudiotollhousestudio Member Posts: 166
    haha, I'm so confused, I'll give this stuff a try though, thanks buddy.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    look at fire maple games profile for some demos relating to this stuff!
Sign In or Register to comment.