Is there a way to have a sprite work individually?

0 favourites
From the Asset Store
_______ Huge collection of metal fixtures ________
  • I am making a game where when you click a friendly base you select it, then when you click an enemy base the friendly base you have selected attacks the enemy base and that base is hurt. The problem is I am having to make like 5 different sprites of the same base so I can control them separately in the events. If I use the same sprite for each different base, whenever I attack one of the bases, it hurts all of them. This makes it so I have to make all the different combinations of bases hurting each other in the events, which is a pain in the ass and is taking forever because there are so many combinations. It would be so much easier if there was a way to make each one respond individually. Someone please tell me there is a way to do this!

  • You aren't picking properly. Posting what you have so far will get you the fastest results.

  • dl.dropboxusercontent.com/u/68458825/game.capx

    Theres what I have so far, the event page is very very very rough so I apologize for that haha

  • there are going to be alot more than 3 bases on one layout in future levels, I just havent made all the sprites for them yet. In short, every friendly base needs to be able to attack every enemy base. On a level with 15 different bases, you can see how that would be very annoying to do the events for.

  • I really can't help, given the current state of things. I'd suggest starting over. Don't duplicate everything. This will work with a single sprite object. Use containers to marry your text and sprite together. Don't do collisions on the text, use the sprite. Your 1/8sec hack from the other thread is not needed. You should have:

    Count=0 ...

    ELSE

    Count=1...

    Then your logic will work correctly.

    If you can get things back to the way you must have had them before, I can help with the picking issues.

  • Ok thank you so much for helping! I cleaned it up and put it back to how I had it. Let me know what I need to do, because right now when you take over the neutral base and then try to attack the enemy base, both friendly bases attack instead of just the one you have selected.

    dl.dropboxusercontent.com/u/68458825/singlebases.capx

  • This is because you're mixing up the sprite and the text, and there isn't a tight link between them. As I suggested, don't use the text for anything but displaying your numbers. Move all the variables to the sprite. That will make life easier. If you can do that first, we can fix any other issues.

  • Well I dont understand how, but that made it work! I changed all the variables to the bases and changed the 1/8 second thing. Thank you very much. Heres what I have now, if you see anything else wrong let me know! Your the man blackhornet!

    dl.dropboxusercontent.com/u/68458825/singlebases.capx

    One more question though, how would I tell the enemy base which friendly base to attack when they are all the same sprite?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • sorry for all the questions, but you said use containers to marry texts and sprites. How would I do this? I cant find containers anywhere in construct or in the manual. Thanks in advance.

  • You need to pick one somehow. What strategy did you have in mind?

    Here's a small improvement. Use containers to marry the sprite with the text, and do a For Each to update.

    singlebases_BHT.capx

  • Click on a sprite. They are part of the sprite already - look on the left Properties panel.

  • That made it a lot cleaner, thanks. Well I need the enemy bases to be computer controlled. I really don't have a set plan for it yet, but I was thinking have the computer attack a random base every X seconds, and then attack a friendly base whenever the base drops below X troops. What would you suggest?

  • System:Pick random instance

    and

    Pick by evaluate and use 'count < X', then randomly pick one of those.

  • Do you mind making an event that would choose a random enemy base, and then make that enemy base attack a random base(friendly or neutral) so I can see how to do this? Or would that not be possible with C2?

  • Now Families help:

    singlebases_BHT_B.capx

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