Page 1 of 1
multi touch
Posted:
Sun Jul 10, 2011 5:22 pm
by praaab
ok so i have my game as ipod format like on screen buttons but i need to be able to touch two buttons at onece like jump and move to the right at the same time
Re: multi touch
Posted:
Sun Jul 10, 2011 11:22 pm
by skydereign
In that case, just have a mouse button down for each event. gE will keep the event going until you release, so having two actors with two separate mouse button down events acts as a form of multitouch.
Re: multi touch
Posted:
Mon Jul 11, 2011 1:56 pm
by praaab
its not working on my ipod when i test it in geplayer
Re: multi touch
Posted:
Mon Jul 11, 2011 2:41 pm
by schnellboot
maybe you tell us what you exactly did
Re: multi touch
Posted:
Mon Jul 11, 2011 3:19 pm
by praaab
ok so when u test the game out on the ipod only one button works at a time
Re: multi touch
Posted:
Mon Jul 11, 2011 7:55 pm
by skydereign
I can make a game, with an actor that has this code.
actor -> Mouse Button Down (left) -> Script Editor
- Code: Select all
r=0;
actor -> Mouse Button Up[ (left) -> Script Editor
- Code: Select all
r=255;
Clone several of them. Now when you test that on iphone, you'll be able to change more than one of their colors. Perhaps your code isn't handling multitouch properly. Do the buttons work properly in the editor when you click them?
Re: multi touch
Posted:
Mon Jul 11, 2011 10:30 pm
by praaab
not really in some spots when u click the button it wont move the actor its like u have to go back or jump and move plus all the buttons are cloned by cloneindex
Re: multi touch
Posted:
Tue Jul 12, 2011 4:18 am
by skydereign
Well if clicking the button in editor doesn't work, then its not going to work when testing on device. You need to create a system that works properly in the editor first, so if you need help with that, give us the code you are trying to move the actor with.
Re: multi touch
Posted:
Tue Jul 12, 2011 4:48 am
by praaab
mouse button down event:
if(cloneindex==0){move=0;dir=0;} //0 is for left
if(cloneindex==1){move=1;dir=1;} //1 is for right
if(cloneindex==2)
{
if(canjump>0){
player.yvelocity-=20;
canjump--;
move=3;
}
}
{
if(huge==3){if(cloneindex==3){CreateTimer("player", "shoot dude", 20);}}
}
//// lolwut
if(cloneindex==0)
{
MoveTo("Button.3", 0.000000, 0.000000, 1000.000000, "sensLeft", "");
MoveTo("Button.2", 0.000000, 0.000000, 10000.000000, "sensRight", "");
}
if(cloneindex==1)
{
MoveTo("Button.3", 0.000000, 0.000000, 1000.000000, "sensRight", "");
MoveTo("Button.2", 0.000000, 0.000000, 10000.000000, "sensLeft", "");
}
/// sounds
//if(cloneindex==0||cloneindex==1){}
if(cloneindex==2){PlaySound2("data/Mario Jump.wav", 0.200000, 1, 0.000000);} //jump sound
Re: multi touch
Posted:
Tue Jul 12, 2011 5:03 am
by skydereign
Well, first off, you should use a switch statement (it is a lot clearer). Here is the code converted to fit within a switch.
- Code: Select all
switch(cloneindex)
{
case 0:
move=0;
dir=0;
MoveTo("Button.3", 0.000000, 0.000000, 1000.000000, "sensLeft", "");
MoveTo("Button.2", 0.000000, 0.000000, 10000.000000, "sensRight", "");
break;
case 1:
move=1;
dir=1;
MoveTo("Button.3", 0.000000, 0.000000, 1000.000000, "sensRight", "");
MoveTo("Button.2", 0.000000, 0.000000, 10000.000000, "sensLeft", "");
break;
case 2:
if(canjump>0)
{
PlaySound2("data/Mario Jump.wav", 0.200000, 1, 0.000000);
player.yvelocity-=20;
canjump--;
move=3;
}
break;
case 3:
if(huge==3)
{
CreateTimer("player", "shoot dude", 20);
}
break;
}
Pretty much a switch takes the variable within the parenthesis on the first line and allows you to execute code based on its value. So, case 0: would execute if the variable equaled zero. case 1: would execute if it equaled one, and so on. It executes code until it reaches a break, which gets you out of the switch statement.
Now to address your actual problem, what in this has to do with movement? Is the movement code in the player's draw? As nothing else has to do with moving anything. Also what are the buttons? Button.0 seems to be a stop button as it sets move to 0, and 1 seems to be a move right. 2 is jump, and 3 is attack. Is that right?
Re: multi touch
Posted:
Tue Jul 12, 2011 5:25 am
by praaab
right and its still not doing the double touch were i can jump and move at the same time on my ipod
Re: multi touch
Posted:
Tue Jul 12, 2011 6:42 am
by skydereign
If you read my post, I said that I changed the code to make it look cleaner. I did nothing to make it work, as you haven't given me enough information to help with that yet. I asked for the information I needed (what moves the actor). Clearly you are expecting this code to move some actor, but I see no code that moves anything (except the jump). As I said before, this is the information that I need.
skydereign wrote:Now to address your actual problem, what in this has to do with movement? Is the movement code in the player's draw? As nothing else has to do with moving anything. Also what are the buttons? Button.0 seems to be a stop button as it sets move to 0, and 1 seems to be a move right. 2 is jump, and 3 is attack. Is that right?
From what you've given me, the player clearly will not move (though he could jump). I need to see the code that actually makes him move, for instance you might have something like this in the player's draw.
- Code: Select all
switch(move)
{
case 0:
break;
case 1:
switch(dir)
{
case 0:
player.x-=5;
break;
case 1:
player.x+=5;
break;
}
break;
}
Re: multi touch
Posted:
Tue Jul 12, 2011 2:27 pm
by praaab
no he can move its just when u jump he cant move until u let go of the jumping button. my friend helped me with the button but im not sure where the moving cod its at
it could be mouse button up: move=2; and mouse leave: move=2; or player> draw actor and then:
//movement on ipod
if(move==1){x+=7;}
if(move==0){x-=7;}
if(move==2){x=x+0;;}
Re: multi touch
Posted:
Wed Jul 13, 2011 12:20 am
by skydereign
Okay, that is why. Yes that draw code is the movement code (notice how it moves changes the player's xy position). The reason you can't move after you jump (unless you let go) is that you keep changing the move variable. Really your move variable makes no sense. To make it work, remove this line of code.
- Code: Select all
move=3;
That is found in your jump button code, so to use the cleaned up switch version, here is the code you should use.
- Code: Select all
switch(cloneindex)
{
case 0:
move=0;
dir=0;
MoveTo("Button.3", 0.000000, 0.000000, 1000.000000, "sensLeft", "");
MoveTo("Button.2", 0.000000, 0.000000, 10000.000000, "sensRight", "");
break;
case 1:
move=1;
dir=1;
MoveTo("Button.3", 0.000000, 0.000000, 1000.000000, "sensRight", "");
MoveTo("Button.2", 0.000000, 0.000000, 10000.000000, "sensLeft", "");
break;
case 2:
if(canjump>0)
{
PlaySound2("data/Mario Jump.wav", 0.200000, 1, 0.000000);
player.yvelocity-=20;
canjump--;
}
break;
case 3:
if(huge==3)
{
CreateTimer("player", "shoot dude", 20);
}
break;
}
My suggestion though is to change how your move variable works. It looks like you are using your move variable more like a dir variable (which you already have). move should equal zero when the actor is not supposed to move left or right, and should be one when it is.