objects interacting with object

This forum is currently in read-only mode.
  • I Feel kinda stupid but..

    how do i get sprite.1 to fallow other sprite.1

    or

    if sprite.1 is overlapping other sprite.1 and sprite.1s y position is greater than other sprite.1 y position move sprite.1 in front of other sprite.1,

    or

    if sprite.1 hp <50 sprite.1 rts move to other sprite.1

    basically I�m not sure on how to get objects of the same type to tell the deference between themselves

  • The y position one is fairly easy.

    +System: For each sprite ordered by sprite.y ascending

    • Sprite: send to front

    The other ones I'm not so sure.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • thanks for that

    yea, right now I�m working on a cannon fodder remake kind of thing. And the whole units following whoever has the highest rank thing is stumping me.

  • thanks for that

    yea, right now I�m working on a cannon fodder remake kind of thing. And the whole units following whoever has the highest rank thing is stumping me.

    You could always make your higher ranks different objects.

    Dunno about objects moving to protect the one with the least health though. I'm too braindead to think right now. I've got one hell of a headache.

  • Following an object is easy enough - give your objects a bullet or ball movement, and always make them rotate towards the object to follow (always - rotate angle towards object). If its an object of the same object type, it might be a little trickier.

  • Yeah see thats the problem. I've been able to rig it so each one is its own object. but what i really want is for the person to link together a Congo line with no cap on the number that can join in the little Congo line thing.

    also want my little Ai controlled dudes to go help there little comrades when there hp gets below a certain point.

    It just seam like theres no way to have an object interact on a complex level with other instances of itself.

    oh and if nobody has the slightest clue what cannon fodder was.

    <img src="http://www.gamemobile.co.uk/images/cannon-fodder-symbian-anim.gif">

  • http://www.quotecats.com/what/congaline.cap

    tada!

    The key is the function object and forget picking, whenever you get into picking troubles this is your friend.

  • That's awesome! It's a slinky!

  • Hey thanks so much for the tutorial. the function object still kinda confuses me, but i think im getting the hang of it. kind of a new trick

  • That's quite alright

    Yeah the function object is a bit weird at first, but extremely useful in these situations where you need to get information on another object that you can't pick (for whatever reason) in the same event.

    I mean you needed to pick instance 1, which automatically unpicks instance 2. So you call a function (forgetting objects), go to a new event where you can pick whatever you want again, then send info back to the first event.

    yeah anyway you get the picture

  • Ok, if i break a link in the chain. it stops the Congo.

    how would i get it to fallow the next in line. without changing the number. if thats possible. i need to be able to make the chain into multiple other chains then merge them back into the original.

  • I don't understand what you want to do exactly.

    If you set one of their positions somewhere, the ones behind it should follow it. You can also add to the for each object loop something that makes it ignore the one you want to move, if you need to.

    If you want one of the objects to leave the line on it's own (or be destroyed), I guess you can set it's value to -1 or whatever then either set all the values behind it to one less than their value.

    Or you could just make the one behind it temporarily always set gotox and gotoy of the one 2 ahead of it (using the same functions, with the parameter as what it was -1) then when it rejoins the line, stop that event somehow and it would go back to its original position in the line, though this wouldn't really work when destroying it.

  • http://www.quotecats.com/what/congaline.cap

    tada!

    The key is the function object and forget picking, whenever you get into picking troubles this is your friend.

    Is there any way of making them stop when they collide (queue behind the leader without overlapping) ?

    If yes, can you show an example plz?

  • just change it from (always)falow to: when object id 1 x position not equal to mouse x

  • yeah basically you can do whatever you want with the movement, all the function stuff does is find out the X and Y of the next one in the line, ('GotoX' and 'GotoY' in that example) so you can move towards that however you like.

    I can't be bothered to make a whole engine heh, but this just demonstrates how to retrieve information from another specific instance of the same object.

    I have to admit it's not ideal when you need things like on collision between Sprite and Sprite, and you have to call about 4 functions, gets a bit confusing, I'm sure its possible though.

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