Make enemy's always run toward my current position

0 favourites
  • 10 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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.

  • 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

  • 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?

  • 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

  • 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

  • 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:

    scirra.com/forum/targetting-specific-instances-of-objects_topic66316_page1.html

  • 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

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