x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Moving a Tower Defense Enemy

My tower defense game will , hopefully, involve placing cannons on Islands dotted along the path of a wave of Pirate Ships. The Ships are obviously going to be on a water plane. I have all the static mesh assets and a basic level setup, but I don't know where to begin for moving the ships from their spawn point. How would you go about doing this.

Product Version: UE 4.18
Tags:
more ▼

asked Feb 05 '18 at 09:27 PM in Everything Else

avatar image

SCarnegie
1 1 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

it all depends on how you want the movement to take place. is your game based on grids? if it is then you could use an array to store the locations of where you want the enemy to move. for example if you had a 100x100 grid you could set the spawn location to x0y0 then the first target location to x0y300 then another location to x500y300 and so on. you could also do this with an array of target points to make the setup for each level a bit easier. see the picture below on how to set this up.

alt text

If your movement isnt grid based and you want things to be more round then you could go with splines. there are alot of tutorials on how to use splines online and i would also suggest looking into the content examples project on the learn tab.

There is the third option of using AI but in this case i dont think its necessary since it would be a waste of resources since there will be many enemies and they are all following the same path. Also in the event you want some enemies to take one path and others to take another it would be easy enough to use a switch or select node to change which path they take.

capture.png (153.6 kB)
more ▼

answered Feb 05 '18 at 10:46 PM

avatar image

ThompsonN13
10.1k 33 9 23

avatar image SCarnegie Feb 05 '18 at 11:03 PM

Splines are probably how I will implement their movement, however, do I need the meshes to be "Pawns", because Ive been playing around with it for a few days, and I havent been able to have a Pawn move yet. Even when using the parent class of default pawn I cant find a way to get the meshes to move when following tutorials on how to move AI/Characters around. Or do I just have a wave of these static meshes move along a Spline, delayed spawning from each other, would I still be able to add health attributes to them if they are just static meshes. I'm not overly familiar with how Unreal handles this in comparison to Unity.

avatar image ThompsonN13 Feb 05 '18 at 11:50 PM

you will want them at the very least to be actors so that they can have their own health values attached to them. as for why your movement doesnt work do you have a nav mesh bounds in your level? if you dont have a nav mesh there will be no navigation data which means most ways of moving your actors wont work. Check out This tutorial on the forum and this similar question and how they worked with splines.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

It's pretty simple you can do it either with use of AI or Just implement auto-movement of actors along spline. I advise you to watch tutorials on how to use AI waypoints or Movement of AI along spline or movement of objects along spline.

Just go to youtube and search on relevant topics, there are plenty of tutorials.

more ▼

answered Feb 05 '18 at 10:17 PM

avatar image

Sardorian
407 8 4 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question