playMaker

Author Topic: random spawn points - please advise.  (Read 5723 times)

JayRastaman

  • Playmaker Newbie
  • *
  • Posts: 15
random spawn points - please advise.
« on: October 05, 2014, 03:15:34 PM »
I was reading this post here -

http://hutonggames.com/playmakerforum/index.php?action=post;topic=4293.0;last_msg=20224

I have had playmaker for about 3 days now so I am still on a learning curve, though I feel I am learning quickly; I just have one question.

I posted the link above because it seems similar to what I am trying to do.

I am making a 2D game and I need to spawn random enemies at random points. Here is exactly what I am trying to do -

1. spawn my particle system and let it go through its 1 second animation.
2. After particle system finishes its animation; enemy appears.
3. enemy moves towards the center of the screen from where it spawns.... X and Y directions only of course.
4. When enemy collides with object at center of screen, enemy dies/disapppears.

Seems simple, but I am not sure how to do it, yet. Any help would be greatly appreciated. For anyone who posts, please be as informational as possible; I want to learn how to do this, not just get an answer. I appreciate any help with this.  :)
In all your getting, get wisdom; Get understanding. -Solomon

JayRastaman

  • Playmaker Newbie
  • *
  • Posts: 15
Re: random spawn points - please advise.
« Reply #1 on: October 06, 2014, 02:03:48 PM »
anyone help?  ???
In all your getting, get wisdom; Get understanding. -Solomon

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: random spawn points - please advise.
« Reply #2 on: October 06, 2014, 02:09:18 PM »
Which of your 4 steps isn't working?

JayRastaman

  • Playmaker Newbie
  • *
  • Posts: 15
Re: random spawn points - please advise.
« Reply #3 on: October 07, 2014, 02:49:00 PM »
Hello and thanks for the reply post.

I'm still stuck on step 1.

I use "create object" to bring in the particle system but it never plays in the scene. Am I using the wrong action? I have already gotten a few simple thing to work. I made a cube that changes color and spins when clicked, so I thought I would move on to handling particle systems. I can't get my particle system to play, though.

I might add that I did get it to work once (don't remember what I did) but it didn't play one time like I wanted - instead it looped and I had "loop" unchecked, so not sure what was going on there...

Im just trying to do simple things with particle systems right now and having trouble. I would be overjoyed to have any help with handling particle systems correctly. And again, thanks for the reply post.
In all your getting, get wisdom; Get understanding. -Solomon

JayRastaman

  • Playmaker Newbie
  • *
  • Posts: 15
Re: random spawn points - please advise.
« Reply #4 on: October 07, 2014, 02:51:23 PM »
Forgot to add - my "enemy" is a sprite animation made into a prefab (of course).
In all your getting, get wisdom; Get understanding. -Solomon

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: random spawn points - please advise.
« Reply #5 on: October 07, 2014, 04:31:05 PM »
I'm not too sure about particle systems with 2D, so I can't help there.

I'd suggest sketching out your gameplay with more simple elements first, then replace them over time as you get more experienced with Unity/Playmaker.

E.g; Don't worry about a particle system for spawning yet, instead create an object, leave it onscreen for the time you wanted, then destroy it, then create your enemy.

If you stick to the basics at first, you can get your behaviours all up and running and then replace bits / make things pretty afterwards.

JayRastaman

  • Playmaker Newbie
  • *
  • Posts: 15
Re: random spawn points - please advise.
« Reply #6 on: October 07, 2014, 08:21:34 PM »
Thanks for the reply. I want to update this post by saying that I did get the particle system to act right and I also got the enemy sprite to spawn in. Now Im having a bit of trouble getting to move on the screen.

I'm trying to get it to move in a random X Y direction after it spawns. I think I may have to create a variable for this. I took a look through the action browser and to be honest Im not sure what to do here. Can anyone please post some ideas on how to achieve this?
In all your getting, get wisdom; Get understanding. -Solomon

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: random spawn points - please advise.
« Reply #7 on: October 07, 2014, 09:32:43 PM »
Either use 'Select Random Vector2' (from the Ecosystem - https://hutonggames.fogbugz.com/default.asp?W1181)

With that you can specify as many positions as you want.

Or create 2 random floats ('Random Float' action) and then use 'Set Vector2 X Y' and insert your 2 floats as the X and Y positions. Store than Vector2 then tell your enemy sprite to move to that position.

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: random spawn points - please advise.
« Reply #8 on: October 07, 2014, 09:39:24 PM »
I would also recommend HOTween for moving your objects around. The Playmaker actions are great.

JayRastaman

  • Playmaker Newbie
  • *
  • Posts: 15
Re: random spawn points - please advise.
« Reply #9 on: October 08, 2014, 03:55:09 PM »
Thanks for the replies jess84 - Im getting to work on them, now! :D
In all your getting, get wisdom; Get understanding. -Solomon

JayRastaman

  • Playmaker Newbie
  • *
  • Posts: 15
Re: random spawn points - please advise.
« Reply #10 on: October 12, 2014, 06:55:32 PM »
I got my sprite to spawn and move, but I have one issue.

After I mouse click on my enemy prefab at runtime to "kill" it, it disappears like its supposed to and the explosion animation begins, but the explosion sprite's animation loops.

Is there a way to make it play only once, using PlayMaker, or should I open the Unity animator (or animation) window and attempt to solve this issue from there? What is the best way to solve this issue?
In all your getting, get wisdom; Get understanding. -Solomon