Is there a way to have a sprite work individually?

Get help using Construct 2

Post » Fri Oct 04, 2013 2:04 am

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!
B
7
S
1
Posts: 97
Reputation: 1,167

Post » Fri Oct 04, 2013 2:10 am

You aren't picking properly. Posting what you have so far will get you the fastest results.
ImageImageImage
B
71
S
21
G
231
Posts: 3,688
Reputation: 129,352

Post » Fri Oct 04, 2013 2:14 am

https://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
B
7
S
1
Posts: 97
Reputation: 1,167

Post » Fri Oct 04, 2013 2:18 am

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.
B
7
S
1
Posts: 97
Reputation: 1,167

Post » Fri Oct 04, 2013 2:50 am

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.
ImageImageImage
B
71
S
21
G
231
Posts: 3,688
Reputation: 129,352

Post » Fri Oct 04, 2013 3:00 am

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.

https://dl.dropboxusercontent.com/u/68458825/singlebases.capx
B
7
S
1
Posts: 97
Reputation: 1,167

Post » Fri Oct 04, 2013 3:09 am

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.
ImageImageImage
B
71
S
21
G
231
Posts: 3,688
Reputation: 129,352

Post » Fri Oct 04, 2013 3:28 am

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!

https://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?mitchjohnson522013-10-04 03:30:27
B
7
S
1
Posts: 97
Reputation: 1,167

Post » Fri Oct 04, 2013 3:39 am

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.
B
7
S
1
Posts: 97
Reputation: 1,167

Post » Fri Oct 04, 2013 3:41 am

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
ImageImageImage
B
71
S
21
G
231
Posts: 3,688
Reputation: 129,352

Next

Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 14 guests