Jump to content


Photo

Whats wrong with my particle generator?


  • Please log in to reply
2 replies to this topic

#1 Aero88

Aero88

    GMC Member

  • GMC Member
  • 419 posts
  • Version:GM8

Posted 06 July 2012 - 06:41 PM

Hi. I am using GM 8.1 Standard and I have been interested in learning about particle generators. I started looking into some video tutorials and began following this tutorial on youtube. I thought I had everything entered in correctly, but after I create the first particle system they start appearing in at (0,0) instead of at the (x,y) of the wand creating my spell. I have looked over it a number of times, but I can't see what is wrong. Why does the first spell work, but the rest mess up? I can tell that he is running a different version of Game Maker in his tutorial, but I don't think that that is the problem. If somebody could look at my project file and help me out I would really appreciate it. Thanks in advance for your time.

What is supposed to happen --- Upon starting the game you will see a wand that points towards your mouse. When you left click a magical spell is shot in the direction of the mouse. The spell should be destroyed when it hits the black wall.


What is happening now --- The first time you click the left button everything works fine, but then any further clicks create the spell in the upper left corner of the room. The spells created in the upper left corner are under the black block so you can''t see it very well.

Download part_system_test.gm81 from Host-A

Edited by Aero88, 06 July 2012 - 10:33 PM.

  • 1

#2 Merlocker

Merlocker

    No Imagination

  • GMC Member
  • 450 posts
  • Version:GM8

Posted 06 July 2012 - 07:09 PM

This is very easy, Under the step event it should be
part_type_destroy(PART)

You were destroying the system not the part.

EDIT: This doesn't fix the bug of it creating at the top left

Edited by Merlocker, 06 July 2012 - 07:19 PM.

  • 0

#3 Aero88

Aero88

    GMC Member

  • GMC Member
  • 419 posts
  • Version:GM8

Posted 06 July 2012 - 10:22 PM

Hm... I tried changing that, but I am not sure if that is what needs to be done. I checked the video tutorial and he was destroying the particle system as well. I am still at an utter loss though as to why it starts creating the emitters in the upper left corner after the first click...

edit: Yeah, chaning that to destroy the part rather than the system makes the game freeze after a couple of emitters are created... It is the system that should be destroyed as the tutorial suggests. I have now also found where my problem was though. I was incorrectly updating the emitter region. In the step event I was providing the index of my Particle type rather than the index of the emitter when updating the region. Now that I changed this is works like a champ. Thanks for your time though.

Edited by Aero88, 06 July 2012 - 10:32 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users