KingdomRush-based movement

0 favourites
  • 13 posts
From the Asset Store
Hand-animated Sprite Base for isometric game/animation development
  • Hi guys.

    My problem is, as the name of the topic suggest, that I would like my troops to move along a fixed path like those of kingdom rush.

    I am aware of the pathfinding behaviour, I have tried plenty of things with this behaviour but with no succes until now. Any help would be appreciated.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If Kingdom Rush is the trailer I just saw, it looks like the example you want is the new RTS template that was just added in the Beta.

    If you have the latest beta, select "New" in the menu, and in the search box enter "RTS"

    edit: It's a bit advanced, but shows how to use pathfinding to move your units in formation while they shoot.

  • Thank you very much for you quick reply. Unfortunately it seems like I cannot figure out how I could use the RTS sample to achieve my goal... I can?t make my troops move along a fixed path, is there a way to make my troops march througn an object. Say I have a road image, I create a sprite object and put the my road image for that object, could I make my troops move through that object?

  • The "Pathfinding path cost" template may help with that. (another advanced technique.) I however haven't worked with the pathfinder yet, to be specific.

  • I could make you an example, it is pretty easy.

    You dont have to use something like "Pathfinding" or anything else.

    You still need 1 ?

  • EDIT: Sry for double post

  • Paradox: Thank you. I took a look at pathfind cost and as you say it might help but at least I was not able to make it work, so I am going to try darklinki�s option, thanks again though.

    Darklinki: I would definitely thank you if you could make an example for me (I had a hunch about pathfinding not being the answer to my problem).

  • Sorry to steal a topic but since there's an answer from just yerteday i better do it now:

    My question in relation to this topic is:

    In this kind of games where a lot of tiny sprites attacks in a fixed, predictable fashion as a whole. If i see this game i still imagine each group of tiny chars as one invisible object of the side of the entire group. And the little sprites are just a single sprite with animations that give the ilusion of being multiple different objects/sprites.

    It's a good technique? It's the one used in this game or i'm talking nonsenses?

    For example, Kingdom rush doesn't seems to use groups as Ninja Town do. Where each sprite/char can separate and be used individually.

  • Hillstrom: You can ask whatever you want, I do not mind. I can answer you this from a programming perspective. I do not think that having a sprite with animations that make the illusion of various troops would be a bad practice, nor having separate sprites for every single unit is either. It is less memory expensive to use a single sprite for an entire or part of a troop, of course, but what really matters is the kind of game you want to create. If your game would gain no extra benefit from having every single unit with its own sprite then just don�t do it. For example, if your game is going to implement a "power" that kills a single unit, not matter how much HP or whatever it has, then the single sprite troop approach is not an option, in the other hand if your game is not going to implement such specific mechanics, and maybe you are going to spawn a fixed number of troops (like in Lord of the rings battle for middle earth), then that approach would be correct. Hope it helps.

  • If u want a sprite to follow a winding road like kingdom rush (fantastic game btw) try using both turret and bullet behaviors for that sprite, also you can set a point in the road for it to go to, then once it hits that point state the next point, plus you can add lots of events & actions for the sprite while its on its route around all your points. :)

  • Hi GeneratorX. Thank you for answering, You solution seems fairly good, however, would I need to "hardcode" those points?. In the other hand (and because I didn?t want to sound rude with GeneratorX), I managed to create the kingdom rush movement using Bezier curves which turned out to be quite easy to implement, if anybody needs it I could create a tutorial, just let me know.

  • You probably found it already but this topic seeks the same mechanic (if i'm not wrong). there's some capx there:

    http://www.scirra.com/forum/collisions-with-multiple-objects-same-spot_topic71607.html

    By the way i'm interested in this kind of mechanics, that's way i'm messing around.

  • Hi Hillstrom. That will definitely come in handy :). If you want I can try and create a Manual :). For now what I did, as I mentionated earier, was to implement a B?zier Curve.

    This is my function: 107*((1-EnemyShip.Speed)^2)+2*(1-EnemyShip.Speed)*EnemyShip.Speed*520+(EnemyShip.Speed^2*Sprite3.X)

    It is messy so I do not expect you to understand it nor use it, but if you ttake the time to look closer at it, and you look at this link :http://devmag.org.za/2011/04/05/bzier-curves-a-tutorial/, you will understand how you could implement this kind of movement. BTW, I used set X, Y instead of "move to object" or other behaviours actions. Right now my function is cuadratic and so it is not quite a circular movement, I am working on the cubic version of this functions.

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