Make enemy's always run toward my current position

Get help using Construct 2

Post » Tue Apr 23, 2013 5:13 am

How do i make enemy's always run in the direction of my c,y co-ordinates on the map? I'm trying to make a silly little space shooter WITHOUT looking at tutorials for a change, just asking for help to circumvent frustration ;) Thanks and, hello i guess! This IS my first post after all, may it not be the last!

Paul.
B
5
Posts: 47
Reputation: 392

Post » Tue Apr 23, 2013 5:28 am

Hey Paul,

The best advice is to follow the tutorials because they will answer your question and you will also learn a couple of other tricks that are vital to know when you begin.

But to answer your question, give your enemy a movement tbehaviour (bullet for example), set the speed of the object to 50 or whatever you want and then have an action that sets the angle of the object to face your desired object and they will hone in on him.

If any of that doesnt make sense try the tutes ;) you will be surprised how quickly you pick everything up.GenkiGenga2013-04-23 05:29:15
ImageImage
B
74
S
17
G
6
Posts: 1,039
Reputation: 10,605

Post » Tue Apr 23, 2013 5:30 am

Avoiding the tutorials is the way to get frustrated. The very first tutorial "Beginners Guide" covers that exact behavior in making the ghost shooter game.
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,428

Post » Tue Apr 23, 2013 6:03 am

Hey there, sorry i wasn't exactly clear, i actually did follow the ghost shooter tutorial and I'd already forgotten that. The tutorial i actually thought was great and i do plan on doing more than the few i've already done.

I've just found that when i get far too into tutorials for anything, not just construct, that i end up just doing what other people do and get burned out or worse, tune out and just follow along not really picking up what's going on.
So I'm currently just having a night or 2 specifically figuring a few basic thing's out on my own and having a sort of 'jam session' if you know what i mean?

So yeah , believe me i will continue the tutorials and i hope there is more of them soon, but the openness of construct itself is what made me want to get a little creative and just go at it alone for awhile :)
Thanks for the suggestions though and i'll go check the end of that tutorial again now!

Paul.
B
5
Posts: 47
Reputation: 392

Post » Tue Apr 23, 2013 6:05 am

Oh, also thanks again for saying to go back to the tutorials, for some reason i thought i had seen them all and there was about 5 or 6 of them. Just went back.......28 pages.....Great!

Paul
B
5
Posts: 47
Reputation: 392

Post » Tue Apr 23, 2013 6:21 am

The tutotials will get you familiar with the basics and then with those down, you can get creative using the building blocks. Painters still have to learn how to mix paint, draw the human body, etc... which most of them do, but then they take that and use it to make their own thing you know?
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,428

Post » Tue Apr 23, 2013 7:22 am

You're right indeed, I've managed to get them working via Set angle towards (Player.X,Player.Y) and it's going pretty nicely. The only thing is i've not seen anything on stopping my enemy objects from spawning right next to/on top of my player occasionally.

In the tutorial respawning enemy's goes like this: "Condition: System -> Every X seconds -> 3
Action: System -> Create object -> Monster, layer 1, 1400 (for X), random(1024) (for Y)"

But i want to make it that they spawn randomly in the same manner as this, however only off-screen preferably. Still, it's probably time for rest anyway at this stage so it's maybe time for a ponder. :) Thanks again!

Paul
B
5
Posts: 47
Reputation: 392

Post » Tue Apr 23, 2013 7:40 am

It hit me as i went to stop,so just incase any beginners like me see this and had the same idea, here's how i figured it out.

Create four 'spawn point' objects off the four respective sides of the map and on the event sheet add an event/action that says System>Every X seconds>Create object enemy at Spawn(The name of the spawn point).X , and Spawn.Y for the x/y locations. For all the other spawn points just spawn the enemy at Spawn2.X/y depending on what you called them.

Paul
B
5
Posts: 47
Reputation: 392

Post » Tue Apr 23, 2013 7:47 am

You can also do like I am doing in one of my projects and have it pick a random spawn point each time as well. Using the Pick Random UID action and assigning it to a variable. Then when spawning your objects pass the variable in place of the spawning object.

Not the same scenario, but it does use picking random objects by their UID, you can check this thread from a couple of days ago as it has multiple examples of behaviors for choosing random objects by UID:

http://www.scirra.com/forum/targetting-specific-instances-of-objects_topic66316_page1.html
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,428

Post » Tue Apr 23, 2013 8:15 am

Thanks,That seems like more of an economical way of doing it. I've stuck it in my favourites until I've had at least a little sleep ;) Good to see such a wealth of information going about!

Paul
B
5
Posts: 47
Reputation: 392

Next

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Justin1967 and 22 guests