Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Use two GetSpriteHitTest at same time

Author
Message
Behdadsoft
10
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 13th Apr 2015 20:39
Hi.

I wrote a code for press two key at same time in Phone.now i have a problem with Use GetSpriteHitTest at same time. mean when I Press first btn, should GetPointerX() and GetPointerY(), also for second btn I should GetPointerX() and GetPointerY() again and this make don't work two btn at same time.



how can use two GetSpriteHitTest at same time?
IronManhood
4
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
Posted: 14th Apr 2015 06:07 Edited at: 14th Apr 2015 06:23
It sounds like you are trying to use multitouch without using the multitouch functions. Maybe you need to use GetRawFirstTouchEvent and GetRawNextTouchEvent if you are touching the screen in two separate places at the same time. I think your problem is that when you press the first button you get the pointer position and when you press the second button the pointer position changes to the second press location, although it is difficult for me to understand you.
IronManhood
4
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
Posted: 14th Apr 2015 08:56
Ok, so I didn't really know how multitouch worked. I decided to mess with it and learn a little. This might help you understand how to use multitouch.


baxslash
Valued Member
Bronze Codemaster
12
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 14th Apr 2015 14:18
Quote: "how can use two GetSpriteHitTest at same time?"

You can use this command hundreds of times per loop. Not sure how many times before it starts to slow things down...

The code you are using should work as you are describing but without seeing more it's hard to say for sure what is going wrong.

Using AppGameKit V2 Tier 1
Funnell7
7
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 14th Apr 2015 14:47
Not sure if this will help or hinder lol... But this is how I use the Multi-Touch commands (although I do not use GetSpriteHitTest)...



Using AppGameKit V2 Tier 1
Behdadsoft
10
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 14th Apr 2015 21:47
@ baxslash

Quote: "You can use this command hundreds of times per loop. Not sure how many times before it starts to slow things down...

The code you are using should work as you are describing but without seeing more it's hard to say for sure what is going wrong."


this is my full code, please see and tell me where is the Problem.



Thanks.


@ Funnell7

Quote: "Not sure if this will help or hinder lol"


thanks, your example is very useful and not hinder (Lol).

but I have a Problem:

I wrote my Multi-Touch code according to your example. but when we touch screen, it return 2 value (hold) while I want create touch for fire bullet and need fire one bullet after pressed fire button. but I don't know how to do it.

this is my code:


Thanks.
baxslash
Valued Member
Bronze Codemaster
12
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 15th Apr 2015 08:20
I can't see anything wrong with your code. I'll try to test later when i'm on a pc...

Using AppGameKit V2 Tier 1
IronManhood
4
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
Posted: 15th Apr 2015 17:37
I think that you want to only fire a bullet once per button press?



I don't know if that will work as you expect.
Behdadsoft
10
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 15th Apr 2015 19:18
Quote: "I think that you want to only fire a bullet once per button press?

+ Code Snippet
if (touch[1] = ControlBtnsSpr[3] and GetRawTouchReleased(1) or touch[2] = ControlBtnsSpr[3] and GetRawTouchReleased(2) or touch[3] = ControlBtnsSpr[3] and GetRawTouchReleased(3))
CreatePlayerBullet()
endif
endif


I don't know if that will work as you expect."


thanks IronManhood, I already I tested this command but it don't work.

Login to post a reply

Server time is: 2019-08-18 23:35:00
Your offset time is: 2019-08-18 23:35:00