How do I don't shoot when touching objects

Get help using Construct 2

Post » Mon Jul 18, 2016 8:43 am

Hi all,

I am working on mobile game where the Hero can choose bullet color to shoot down specific color enemy. Game is top-down shooter. The problem is with selecting color and shooting. I have 4 color cubes on which touched i choose specific color, but at that time my hero shoots on that way, because with touch on anywhere on screen hero spawns the bullet that way. At first I selected double touch to spawn the bullet, but that isn't easy for player, so it would be better if shooting can happen with single touch.

Could there be any way how to fix this problem, so my hero won't shoot when I touch any of the cubes when select color?
B
9
S
1
Posts: 11
Reputation: 449

Post » Mon Jul 18, 2016 10:10 am

The best way I can think of is to make an invisible rectangle around the colored boxes (so you get a margin to touch)

Then in the event where you say on touch > fire bullet make a second condition
is NOT overlapping with invisibleBox

So now it's touch anywhere - except for the box

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Mon Jul 18, 2016 4:45 pm

is cube touch action disable bullet
is cube not touch enable bullet behaviour
B
251
S
39
G
15
Posts: 1,964
Reputation: 40,721

Post » Thu Jul 21, 2016 2:26 pm

@fm4fanAT I somehow don't know how to make NOT overlapping object, because there is Overlapping object, and with invert it didn't worked.
B
9
S
1
Posts: 11
Reputation: 449

Post » Thu Jul 21, 2016 3:01 pm

Image
This works: add a red square to the Ghost Shooter demo, and switch to Touch. No bullets fire if you press the red square.
ImageImageImage
B
71
S
22
G
240
Posts: 3,732
Reputation: 133,990

Post » Fri Jul 22, 2016 7:08 am

@blackhornet Thank you very much, I couldn't find Else event before. :)
B
9
S
1
Posts: 11
Reputation: 449


Return to How do I....?

Who is online

Users browsing this forum: Blendi1223, kellehk, TRMG and 28 guests