Help needed; first game's slow start

So I am starting my first game after a few Unity 3D tutorials, hooray! However there’s a bit of an issue from following along with a tutorial… There’s a LOT to look at. Unity has so many useful tools and things to look at, that I’m having trouble figuring out where to start/where to look for some of the basics.

I’m trying to start making a 2D tower defence game. I have a placeholder tower with a barrel and an animated muzzle flash to show that the tower is ‘firing’ at an enemy, as well as a basic enemy shape that will crawl along and get shot at (all courtesy of MS Paint’s array of tools horribly drawn with a mouse). But I’m having trouble starting the actual coding.

  1. trying to move the enemy in a line to the left. I am trying to call a Vector 2 (-1, 0), also using the transform command. However getting them to work together… there’s the trouble.

  2. rotating the tower to face the enemy, wherever they may be. But it’s rotating the whole image, rather than turning the tower, like the pivot point is off. I keep moving it and it keeps returning to an incorrect position.

Any tips on where to look to help solve these problems (however simple and stupid they may be) would be greatly appreciated. Thank You!

If you don’t know how to move an enemy in a line to the left, then you didn’t watch to many basic tutorials. Can you link me some of those tutorials you did?

In my opinion the best way to start creating game in Unity is to start simple and look for specific functionality to implement. That means you have to be a very good friend with Unity documentation and google. Also, you must study the problem at hand, like moving Unity’s gameobject. Research and find all possible ways to move an gameobject in Unity. For example:

  • using Unity Physics,
  • setting the Transform component of gameobject manually
  • using Unity methods like Translate object (using Vectors)
  • etc

When you are aware of all option you can then choose one that suits you best and start typing in google something like: “Moving player on x axis Unity”.

With each find and read you will know a little bit more about implementing your functionality and a bit more about Unity and game development. The key is to have knowledge of all option, not just copy someone’s code and use. But learning is a process. It takes time.

At least that is my opinion. :slight_smile:

1 Like

I did the Sleepy Shooter, as well as the Roll a Ball, and the Space Shooter.

And it’s not that I couldn’t go back and watch the piece I need for enemy movement, but I want to be able to know I can use transform and how to call it, rather than copy/pasting it. Especially seeing as Unity has a lot of the tools listed, but it’s a cumbersome list; one I don’t want to HAVE to comb through for everything. Maybe for the occasion that I need something I wouldn’t normally, but not for simple things like this.

Though I see what you mean by finding every way to move a game object and then tackling the problem. So far I was only looking for Transform. But if I search every way, I suppose at least one of them will stick. Thanks :slight_smile:

A big part of development is just figuring out how to do things.

If you want to learn how to 'use transform and how to call it’ then stop ‘copy/pasting it’ and learn how to write it yourself by using the Unity Scripting Reference and the Tutorials. The scripting reference gives you (most of the time) all of the data you need to use something, often with example code and the Tutorial gives you a clear example of how to use it as well so the only problem is that you aren’t trying to do it yourself.

Copy/Pasting doesn’t help you understand or learn anything. While learning, make a rule with yourself to never copy-paste code and always re-write it - preferably not by reading the other code but by reading how it works and doing it yourself from scratch after the tutorial gives you a head start and points you where to look.

There is also an overwhelming amount of information online from various sources from people asking very directly how to do something or how some code works. With all of these sources you can certainly figure out how something works. You just have to look and apply yourself.