Flopjack's uber question thread

Hello everyone. I’m very new to unity and will have a barrage of questions which I’m sure are very simple. When I can’t find an answer with some searching the web I’d like to simply use one thread here, bookmark it and keep bumping it when I have an issue.

I went through a tutorial on a simple space shooter (by someone I can’t remember, but thanks a lot! Very cool!) and I’m hooked. I’ve taken that work and am trying make the game more robust in a test for a much larger project a year or so on down the line.

I have version Unity 2.5 and am on Windows 7 Home Premium.

  1. How does unity name the mouse wheel when you click in on it? (Unity assigns “fire1” and “fire2” to left and right click perspectively.)

Edit: ^Figured this one out. It’s “Fire 3”. Duh, Flop.

  1. Taking that same tutorial, how can I create a second enemy with with a hit point value?

  2. I have a number of nice models of additional spaceships for my little game. Someone handed me an .fbx file with about 20 ships in it, varying in size and shape. Even though I can separate and individually modify them I can’t seem to create a prefab out of them and allow either randomly generated enemies such as the red ball in the tutorial or scripted/pre-determined enemies…

  3. How do I create pre-determined enemies rather than randomly generated ones? (5 enemies fly from the left then 5 from the top)

  4. How can I get the fire to fire towards the current location of the mouse rather than in a straight line?

  5. How can I create a custom cursor? I’d like to have a target or some small targeting indicator for a mouse. Perhaps a faint laser line pointing from the ship to the center of this target too.

  6. Currently, I removed “GetButtonDown” and replaced it with “GetButton”. I want an auto fire but the rate of fire is something like a zillion a second. Apparently it’s based on the frame rate and is trying to fire a shot every frame. I want a steady stream of fire but simply not so fast. How can I modify it and change it to balance the firing rate of the player?

  7. I assigned right click to fire an alternate shot, which is larger and slower. The player must click to use this shot each time vs holding their primary fire. I would like this shot to deal more damage than the primary fire and have a meter which governs how much they can use it. If they deplete this meter fully they can’t use their secondary fire again for a little bit of time. How do I go about creating this?

Any help would be greatly appreciated. I have some coding experience in Flash but I’m pretty much a newbie at this. Thank you.

Although a noob here myself, it’s generally more helpful to the community to keep each question in a different thread. That way it’s easier for other people.

You dont have to worry about bookmarking, you can keep track of all your posts from your profile.

For question 1 take a look at how fire 1 and 2 are defined in Edit → Project Settings → Input.

Hi, Flopjack - welcome to the forum!

To be honest, answers to most of your questions are quite difficult to guess at without knowing which tutorial project they relate to. However…

What exact problem are you having with the models?

There’s a script posted in this thread.

You could record the time of the last shot (obtained with Time.time and then get the current time each frame. If the current time minus the last shot time is greater than the minimum time between shots, then it is OK to release another shot.

I don’t remember where the tutorial was. It was simply a yellow square firing at red dots and you once you hit 5 you won but if you got hit 3 times you lost.

Thanks for the help, but you’re going to have to explain this more newb friendly. I’m sure I don’t add Time.time just anywhere in the script to get it to work. Also, I don’t know what parts of the cursor script I need to add and which ones I don’t. I tried to copy+pasta that bad boy in there and there errors. I gather it was trying to locate a custom cursor which I don’t have but I am lost on it all.

Thanks for your help to begin with though.

For the models, I have a number of spaceships. I import one fbx file and it brings them all in. They are all in a single file, but I don’t think I can use them in that way. They are a single prefab in the project view. When I drop them into my scene and try to separate them via hierarchy it says they will lose their prefab connection. I should be able to drag them into a new prefab from the hierarchy to the project view, right? (The individual ships that is.)

Meh, I don’t have enough knowledge of unity to even explain my question. :frowning:

Shameless bump

Any other help on those other questions/concerns?

The tutorials referred to are the video tutorials written by TheLorax and can be found in the Teaching forum.

The enemy is a single object that has it’s position changed as it reaches the bottom of the screen. To have multiple enemies, make it a prefab (use the bullet as an example) and have a variable that stores the number of points it is worth.

Perhaps some type of enemy spawner class that creates instances of the prefab, setting their starting positions and velocities accordingly?

Let me re-phrase this: I don’t know a lot about unity. I don’t know how to " To have multiple enemies, make it a prefab (use the bullet as an example) and have a variable that stores the number of points it is worth."

I have pre-fabbed (if that’s a word. :stuck_out_tongue: ) enemies be simply duplicating them. I made a variety of enemies sizes too but they all have the same amount of hit points: 1. (note that hit points doesn’t mean how much score they give, it’s how much health an enemy has before dying)

If you are missing basic Unity knowledge, you might consider starting with the basic tutorials, work yourself through the editor and scripting part and try out the 2D and 3D Platformer ones . There are plenty more to find .

Understanding these concepts will answer most of your questions .

Then, build your dream :slight_smile:

–
oxl

Good idea capn’. I think I do need more foundation.