Destructible Environments - Spawn In Exact Spot Issue

Mack_DundeeMack_Dundee Member Posts: 31
edited November -1 in Working with GS (Mac)
I'm toying around with some shooter elements and I'm having a problem getting the walls to show destruction at the location at which they are shot by a gun. (When the bullet hits a wall, I'd like to show some blast damage on the wall.) What I've done is I've created a blast damage actor to spawn when a bullet hits the wall, but it keeps spawning in the middle of the wall, even when the bullet hits near the bottom of the wall. I've been looking through the forums and at about a dozen templates and the kinds of spawning I see are in general areas and not constrained within an area.

Here is the method I've tried to no success:

1) I created a game integer attributes called BulletX and BulletY. (I've also tried real attributes.)
2) In the bullet actor I've created a rule and two attributes.

Rule: actor-collides-wall
Change attribute: game.bulletx TO self.position.x
Change attribute: game.bulletY TO self.position.y

3) In the wall actor I've created a rule and a spawned actor behavior. (I've also tried using a timer before this one would take effect.)

Rule: actor-collides-bullet
Spawn Position: game.bulletx AND game.bullety

(Please note that I don't have any rules or behaviors for the blast damage actor - the one being spawned.)

Even if the blast damage actor were to appear directly over the edge of the wall in the exact spot where the collision occurred, I could work with that. I could just manually add or subtract pixels in the x direction of the spawn actor box to nudge the blast damage actor into place. But the y direction needs to have some precision for the effect to work.

Thanks for your time.

Comments

  • Mack_DundeeMack_Dundee Member Posts: 31
    To help if their is any confusion, what I'm looking for is how to control the spawn area with precision.

    Thanks.
  • Mack_DundeeMack_Dundee Member Posts: 31
    I've tried a lot of things and, for those looking for a similar answer, the best thing I've been able to come up with is to make very tiny target areas and whenever the bullet hits one a damage actor spawns in that spot. If you find that damage actor spawns over each instance of your tiny target areas after a single bullet collision, be sure to set things in the spawn box so that the damage actor spawns in a layer in front of your target actor.

    Another thing that kept setting me back on this was that I had a scrolling environment. Anyway, the tiny target area works fine even when scrolling.

    Still, if anyone has any suggestions I'd love to read them.
  • AppsRacKAppsRacK Member Posts: 346
    First dont use integer on coordinates use REAL cos they are real numbers unless you floor them.
    Second place the spawn rule in your bullet not on the wall.

    Rule.
    if bullets collide wall
    spawn Explosion actor to bulletx & bullety
    --> set relative to scene.
  • CaliberGamesCaliberGames Member Posts: 33
    could you create a template to see what you are doing wrong?
  • Mack_DundeeMack_Dundee Member Posts: 31
    Thanks a lot for your time Drahc and AvalancheGames.

    @Drahc, as soon as I read your response I just shook my head! I tried all of these complicated things that I knew were only going to cause a slowdown when properly tested and the answer was so simple. Yes, the key is to use the spawn rule at the bullet and not the wall.

    In fact, I don't even think you need to use attributes. You can just change the spawn positioning value to move the spawned actor to the correct spot (i.e., 10 pixels to the right relative to the actor). I don't see why this method wouldn't work with a scrolling background, but I'm going to test it. If it doesn't work I'll add to this thread just in case someone wants to try something similar in their game.

    Otherwise, here's the concise way to do it:

    Rule.
    If bullets collide wall
    Spawn Explosion actor
    Front of layer
    Position 0 & 0 (or adjust for proper placement)
    Relative to actor

    Thanks again, guys!
Sign In or Register to comment.