How do I select weapon on touch screen devices

Get help using Construct 2

Post » Sun Jun 08, 2014 10:49 pm

In a wack a mole type game i want to have enemies that get killed only with a specific type of weapon.
At the bottom of my screen i want to have for ex. 4 icons that represent the 4 different weapons.
If i touch the 1st one, whenever i touch an enemy, he will get hit by that weapon and if it is the correct one he will die.
If i touch the 2nd, 3rd or 4th icon, whenever i touch an enemy he will get hit by the 2nd, 3rd or 4th weapon.

I believe this must be simple but im new here and im a bit confused..

Thanks in advance.. :)
B
21
S
4
Posts: 59
Reputation: 1,261

Post » Mon Jun 09, 2014 11:52 am

you need to match variables in order to find right weapon.

create instance or enemy variable, give them different value and same for weapons

so if a mole comes out with instance variable then tap 2nd weapon and compare mole variable with weapons variable if they equal then kill the mole or else not!

hope it helps!
Every Game is a Good Game it's just few people like and few does not! Keep coding people some day you will be a "NOTCH".
B
21
S
6
G
3
Posts: 85
Reputation: 4,607

Post » Mon Jun 09, 2014 12:12 pm

Thanks for the reply!
The thing is that i want to tap on weapon 2 to select it, and then, when i tap on the mole, weapon 2 will spawn under my finger,kill the mole and destroy it self.
Then, whenever i tap a mole, weapon 2 will still spawn (since i have selected it) but if i tap on weapon 1,3 or 4, that other weapon will spawn under my finger whenever i touch the screen in order to kill the differed type o mole...
B
21
S
4
Posts: 59
Reputation: 1,261

Post » Mon Jun 09, 2014 3:24 pm

The concept is same ! the only difference is instead of weapon instance variable use global variable and set the variable and use different condition as to reset that as per your requirement. if you can share capx file I can edit and reconstruct it as per your need!
Every Game is a Good Game it's just few people like and few does not! Keep coding people some day you will be a "NOTCH".
B
21
S
6
G
3
Posts: 85
Reputation: 4,607

Post » Tue Jun 10, 2014 9:47 pm

Well, the capx has only some basic sprites to represent our weapon and emeny sprites so it will be easier for me and others to understand how it will work..

Again, thank you very much for your help!

PS The blue and red squares represent the weapons :D
You do not have the required permissions to view the files attached to this post.
B
21
S
4
Posts: 59
Reputation: 1,261

Post » Wed Jun 11, 2014 1:05 pm

So i guess its a bit more tricky than i thought?
B
21
S
4
Posts: 59
Reputation: 1,261

Post » Fri Jun 13, 2014 6:51 am

Its a 5minute works hope it help!
selectAndUseWeapon.capx


if you want to add massive weapon and enemy type i suggest you store in array.
You do not have the required permissions to view the files attached to this post.
B
6
Posts: 10
Reputation: 300

Post » Fri Jun 13, 2014 11:00 am

Thanks a lot my friend! I will check asap! (im at work right now) :)
B
21
S
4
Posts: 59
Reputation: 1,261


Return to How do I....?

Who is online

Users browsing this forum: mekonbekon, yippiez and 9 guests