Explosion Area Define

creativeappscreativeapps Member Posts: 1,770
edited November -1 in Working with GS (Mac)
I want to petrol tank for example patrol tank blast size is 150 width and 150 height and that time I want to define perticular area suppose car is park from 200 pixel. That time I want to blast car also with petrol tank. And suppose car park 300 away from petrol tank I donot want to blast car.
How to do that. Please explain. Its radius count or something else?

Comments

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    You can get the distance between objects with the magnitude function. Say you have two game level attributes that track the car's position (carX, carY) -- then in the tank actor, you can can find the distance between the car and the tank (self) with:

    magnitude( game.carX - self.Position.X , game.carY - self.Position.Y )
  • creativeappscreativeapps Member Posts: 1,770
    thanks for your reply. Can you or anyone expalin me step by steps I understand but confused.
  • DrGlickertDrGlickert Member Posts: 1,135
    I'd make an X and Y real game attribute. When the tanker explodes do a change attribute for the X and Y; change attribute position.X to self.position.X and position.Y to self.position.Y. Then do true/false change attribute explosion to TRUE.

    Game objects would have a self.magnitude real attribute
    Rules on the game objects that would take damage would look like this;
    When explosion = True:
    Change attribute self.magnitude to;
    magnitude( game.position.X - self.Position.X , game.position.Y - self.Position.Y )
    Rule; if magnitude = < 150 change attribute self.life to - ??? (whatever you want here)
    if magnitude is >150 AND < 250 change attribute self.life to - ??? (whatever you want here)
    if magnitude is > 250 change attribute self.life to - ??? (whatever you want here)
    Chagne attribute self.magnitude to 0 (Put this last so it changes back for future explosions).

    Hope this makes sense.
  • creativeappscreativeapps Member Posts: 1,770
    ok thanks for that
Sign In or Register to comment.