GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Spawning Particles at specific position

Village IdiotVillage Idiot Posts: 486Member, PRO
edited August 2015 in Working with GS (Mac)

I'm having trouble trying to get particles to spawn at the point where the hero collides with another actor. Hopefully my screen grab helps explain the situation. I've got particles spawning at self.position.Y. The problem is that they seem to spawn quite a distance down from the point of collision – in particular they appear to be doing it more so towards the bottom of the screen. I'm thinking that it might have something to do with the self.Position.Y+150 area.. this was created in order to make only a section of the actor sensitive to the hero. Any ideas?

Comments

  • SocksSocks London, UK.Posts: 12,822Member
    edited August 2015

    ...

  • Village IdiotVillage Idiot Posts: 486Member, PRO

    @Socks umm.. nice tiny running dude under your 'post'. But.. are those three dots a clue? 'Coz I can't work it out. Are you saying that I haven't given enough info?

  • LovejoyLovejoy Posts: 2,078Member

    @monkeyboy simian said:
    Socks umm.. nice tiny running dude under your 'post'. But.. are those three dots a clue? 'Coz I can't work it out. Are you saying that I haven't given enough info?

    Try spawning an invisible actor instead, and in the spawned invisible actor put in the particle behavior.

    Fortuna Infortuna Forti Una

  • Village IdiotVillage Idiot Posts: 486Member, PRO
    edited August 2015

    @Lovejoy Thanks.. but I'm unsure how to make the invisible actor be in the right place at the right time.

    That Rule thatI've got with the Hero.Y etc is there to confine the collision area to just the top of one actor. In this case it's a flower on a stalk which randomly spawns from right to left scrolling across and is spawning at different heights to give the effect of taller and shorter flowers.

    I've got a hero actor which is a bee that the player guides to the flower to score. I was hoping to give it a bit of pizzaz with the particle effect whenever the bee collides with the top of the flower. I have the collision sensitivity zone working with the scoring just not with the particle effect.

    As I said above - for some reason it's ok when the bee collides with flower tops when they're spawned taller but it always spawns the particle effects about 3cm lower once the flowers are shorter.

    I would've thought that by spawning the particles using the self.Position.Y attribute that it would work - which it sort of does - with exception to the 3cm difference as I just mentioned.

  • Village IdiotVillage Idiot Posts: 486Member, PRO

    I know I should speak in terms of pixels – I'm just not quite ready yet..

  • Village IdiotVillage Idiot Posts: 486Member, PRO

    @Lovejoy I tried the idea that you suggested and it does the same thing as my method. How can this be so? Do you think it's because of the the self.Position.Y +150 thing I've got happening?

  • Village IdiotVillage Idiot Posts: 486Member, PRO

    Nothin?

  • LovejoyLovejoy Posts: 2,078Member

    @monkeyboy simian said:
    Lovejoy I tried the idea that you suggested and it does the same thing as my method. How can this be so? Do you think it's because of the the self.Position.Y +150 thing I've got happening?

    I don't quite understand how everything is set up, but perhaps try to make the bee spawn the particles actor. Seems like it would be easier than the flower spawning it.

    Fortuna Infortuna Forti Una

  • Village IdiotVillage Idiot Posts: 486Member, PRO

    @Lovejoy I tried that before but it didn't work. I've just tried again only this time I entered self.position.X and self.position.Y in the velocity/position field of the particle emitter and I think it's now spawning in the right place. Would that sound right to you? I've got to adjust the spawn rate etc to get a more accurate idea of whether it's on the mark though. I do think it's an improvement.

  • LovejoyLovejoy Posts: 2,078Member

    @monkeyboy simian said:
    Lovejoy I tried that before but it didn't work. I've just tried again only this time I entered self.position.X and self.position.Y in the velocity/position field of the particle emitter and I think it's now spawning in the right place. Would that sound right to you? I've got to adjust the spawn rate etc to get a more accurate idea of whether it's on the mark though. I do think it's an improvement.

    If its starting to work like it should then just tweak it until you get your desired result. Also try switching the Relative to: actor and scene, both options give different results.

    Fortuna Infortuna Forti Una

  • Village IdiotVillage Idiot Posts: 486Member, PRO
    edited August 2015

    @Lovejoy Dammit.. I've just tested it more thoroughly and it's setting off the particles for the entire length of the flower (the top and the stalk).. Thanks for your help.. I'll just keep plugging away - I'll also try what you just mentioned.

  • zolbagzolbag Posts: 8Member

    Is the size of your scene bigger than your camera/device screen size? If so, is the game positioned in the far left hand corner? If it's not in the left corner, like if you moved the camera to help with space and see all the off-scene actors, it'll really mess with things like self.Position, as well as game.Mouse Position. Hope this helps a little :sweat_smile:

  • Village IdiotVillage Idiot Posts: 486Member, PRO
    edited August 2015

    @zolbag Nah - just checked.. but thanks for the input. I'm going to try and explain the setup again in the hope that one of the resident Jedis will be able to help. I've attached a file that shows how I've got the weird hero/actor interaction going. Someone called HopScotch gave it to me. I think that this is the reason why I can't make it work.

    The way I see it is that the particle emitter wants you to input x and y values for where it is to emit from – which makes sense. The problem is (I think) that because there's a range of touch sensitivity. I've circled where it happens in a screen grab I've also attached.

    I've tried emitting the particles with self.Position.Y and game.HeroY and they both end up producing the same effect – which is that the particles emit just fine when the hero (a bee) and the actor (a flower on a stalk) collide for most of the Y axis.. it's just down the bottom and depending on which variation I use, the top as well, where the particle emit a distance away (along the Y axis) from the actors. Can anyone help here? I'm not sure how much more info would help. Help me Obi Wan Kanobi – you're my only hope!

  • LovejoyLovejoy Posts: 2,078Member
    edited August 2015

    Is this what you're trying to do?

    Edit:

    @monkeyboy simian

    Fortuna Infortuna Forti Una

  • Village IdiotVillage Idiot Posts: 486Member, PRO
    edited August 2015

    @Lovejoy Yeah – I've got this happening already, only instead of balloons on sticks I've got flowers on stalks. It all works fine – just the thing with the particles is causing a problem. Do you think my theory is on the right track?

    PS: I'm not trying to do the exploding bit like he did – actual particle effects.

  • LovejoyLovejoy Posts: 2,078Member

    @monkeyboy simian said:
    Lovejoy Yeah – I've got this happening already, only instead of balloons on sticks I've got flowers on stalks. It all works fine – just the thing with the particles is causing a problem. Do you think my theory is on the right track?

    PS: I'm not trying to do the exploding bit like he did – actual particle effects.

    the project i uploaded is using particles. Notice the exploding behavior is disabled.

    Fortuna Infortuna Forti Una

  • Village IdiotVillage Idiot Posts: 486Member, PRO
    edited August 2015

    @Lovejoy oh - I thought you'd just uploaded the same file.. sorry.. am looking at it now

  • Village IdiotVillage Idiot Posts: 486Member, PRO
    edited August 2015

    @Lovejoy Is that what you re talking about earlier in the thread? Man, I've got a lot to learn.

  • Village IdiotVillage Idiot Posts: 486Member, PRO
    edited August 2015

    @Lovejoy I think that's exactly what I need it to be doing. I'll have to go over it to get it in my head – I struggle to understand these things. I don't come from a programming /maths background. Thanks a heap! I've been banging my head against this for days now.

  • Village IdiotVillage Idiot Posts: 486Member, PRO

    @Lovejoy I was wondering why you spawned the particle actor at 175 for the Y axis? Is it because it's in-between 150 and 200? As it's got in the game.HeroY attributes ?

  • Village IdiotVillage Idiot Posts: 486Member, PRO

    @Lovejoy Got it working! I am very happy now!! It's amazingly simple! Thanks heaps again!

  • LovejoyLovejoy Posts: 2,078Member

    @monkeyboy simian said:
    Lovejoy Is that what you re talking about earlier in the thread? Man, I've got a lot to learn.

    Yes

    @monkeyboy simian said:
    Lovejoy I was wondering why you spawned the particle actor at 175 for the Y axis? Is it because it's in-between 150 and 200? As it's got in the game.HeroY attributes ?

    Correct

    @monkeyboy simian said:
    Lovejoy Got it working! I am very happy now!! It's amazingly simple! Thanks heaps again!

    No problem :)

    Fortuna Infortuna Forti Una

Sign In or Register to comment.