Space invaders. Random alien shot. How to?

This forum is currently in read-only mode.
From the Asset Store
Spaces Ambience contains 102 Sounds: 53 track and 49 sounds
  • I'm trying to make a Space Invaders game but I'm stuck already

    How would I go about randomly assigning an invader to fire and positioning the bullet at that ship? I can't find anything on random numbers etc.

    Thanks.

  • Scrub that, I found it. Everything is in there if you search for it. Just a bit confusing for a newbie.

  • Perhaps you could post your solution in case anyone else searches/reads this post - I suppose you used a 'pick random' condition followed by 'spawn an object'?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ye sorry.

    I use the SPRITE - PICK ONE AT RANDOM event. Then set that to spawn a bullet, which was set to fire down the screen (in the bullet options). The problem was, it fired all the time. So I also added a RANDOM condition to the event so that it didn't. I found that getting it to choose a number between 1 and 100 and allowing it to fire if it picked 50. You can add a condition to an event just by clicking on it when you've created it, a popout appears allowing you to set it.

    This is how it looked in Construct Event panel.

    <img src="http://img211.imageshack.us/img211/7766/shoot.jpg">

    Great peace of software BTW. I'm lucky enough to be able to search through the options and commands but I imagine there's loads I'm missing. Hoping to help with the Wiki if I become comfortable enough to pass on my knowledge.

  • It might be better to use 'every X milliseconds' with a random interval, or even a constant interval (eg. every 500 ms). The way you've done it there it chooses a random number every frame. So if someone's computer is slow and running at half the framerate, the enemies fire half as often, but would keep moving at the same speed (see TimeDelta).

    This is another reason to post your own answer: you might not have done the best thing!

  • Makes sense.

    Cheers, I'll try it your way. Tend to forget that people still have slow comps. Most now can run games like this easily.

  • That's true, but it's not the only issue. Take a look at that article. Basically the way you've done it changes speed depending on the framerate, and it shouldn't. If you v-sync your game (which makes it look smoother), one PC may run the game at 60fps for a 60Hz monitor, and another at 120fps for a 120hz monitor. The guy with the higher refresh rate would have a much harder game, your way, because enemies fire twice as often!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)