Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Shooting gallery--shooting object vs scrolling screen (swiping) left or right

Posts: 5Member, PRO

I have created a shooting gallery type game, but am having difficulty in distinguishing between the player shooting a target, vs the player trying to scroll the screen left or right. The playing area is wide, and the player can scroll left or right to see the entire playing area, and all of the possible targets. I have created some programming that kind of works, however, sometimes when the player scrolls the screen by swiping it will also cause the player to fire a bullet when it is not supposed to (not good, since the player is trying to scroll the screen and not shoot).

There is a game out on the market that has figured this out, it is a good example of what I am trying to achieve, it is called Crazy Chicken Remake. That game can scroll, and shoot, with no confusion between the two.

Here is what I have done so far to try and figure this out:

I have created a Game Integer Variable called Swipe Value. I set this to 8. (This value represents the amount of movement that is acceptable to be considered a shot, vs a scrolling movement).

Then for shooting a bullet (the idea here is to tap the screen at a target to shoot a bullet) I made the following rule:
IF: "game.swipe value" is > magnitude(game.Mouse X Value - game.Mouse Position X,0)

Then if this condition is true, then shoot the bullet, hit the target, etc...
The translation of the rule is: if the players touch is less than 8 then okay to shoot a bullet!

I created an actor for to represent the background. I created a self integer variable called "Swipe" and set it to a value of 30.
Then for this actor I created the following rule:
IF: "self.Swipe" is < magnitude(game.MouseX Value - game.Mouse.position.x, game.Mouse Y Value-game.Mouse.position.y)

Then if this condition is true, then scroll the screen according to the touches of the player (left or right).
The translation of the rule is: if the movement of the players touch is greater than 30 than then scroll either left or right!

These rules work most of the time, but not always. Any ideas on how to adjust these values, or add or change the code to make it solid with no spurious shooting when scrolling? Hopefully I explained the situation, if I missed anything, or further explanation required please ask. Thanks for any help provided!

David