Need help with Iphone game Controls..

Game Editor comments and discussion.

Re: Need help with Iphone game Controls..

Postby peedalein » Mon Nov 21, 2011 3:41 pm

Hi Chai!

I really do not get what you mean.

Currently, there are 3 buttons. Right, left, Jump.

The problem appears when 2 of the 3 buttons are clicked/entered (mouse enter). Therefore I do not see how making 2 buttons out of 3 solves my problem. Please enlighten me :)
peedalein
 
Posts: 54
Joined: Mon May 17, 2010 2:26 pm
Score: 1 Give a positive score

Re: Need help with Iphone game Controls..

Postby Chai » Tue Nov 22, 2011 1:40 am

peedalein,

oh my bad, I thought you use your finger to guide your character direction.

If you use 3 buttons for your game so you no need to worried at all.
Because, it will work when you play on your iPhone.
Moreover, you can use normal code for those button.

Do you test your game on iPhone?
You will not know until you run your app on the device.

btw, you can't test multi-touch function on PC right?
User avatar
Chai
 
Posts: 361
Joined: Sat Apr 30, 2005 2:26 pm
Location: Thailand
Score: 30 Give a positive score

Re: Need help with Iphone game Controls..

Postby peedalein » Tue Nov 22, 2011 6:31 am

Hi Chai,

I tested the game on the iphone and it did not work the way I wanted it to.

If I use mouse enter events for the left-right controls and then press jump while the character moves left-right, the character stops.

If the left-right controls are set to mouse button down events and then press jump, while the character moves left-right, the character keeps on moving.
However, I'd prefer to use mouse enter events (my "betatesters" prefer mouse enter events :)).
peedalein
 
Posts: 54
Joined: Mon May 17, 2010 2:26 pm
Score: 1 Give a positive score

Re: Need help with Iphone game Controls..

Postby Chai » Tue Nov 22, 2011 7:36 am

peedalein,

I do not know why you use mouse enter event.
Because mouse enter event will work only when mouse point enter the the button area.
That is the reason why it can't press 2 buttons for 2 events at the same time.
[Mouse point can't stay in 2 places at the same time.]
Even in Flash game have the same problem like this for mouse enter event.

In this case, you should use Mouse Button Down Event "Left" and Mouse Button Up event.
It will work.
User avatar
Chai
 
Posts: 361
Joined: Sat Apr 30, 2005 2:26 pm
Location: Thailand
Score: 30 Give a positive score

Re: Need help with Iphone game Controls..

Postby peedalein » Tue Nov 22, 2011 10:33 am

Yes, it works with mouse button down events. But I noticed that people prefer to use a touch display...

Imagine, the player has his finger on the right button, then slides to the left button - with mouse button down events. There is no reaction as there has been no mouse button down event.
The player has his finger on the left button but the actor is not going left. The player thinks that the controls are badly implemented. Therefore I'd prefer mouse enter.

I guessed that Ripper had found a way to bypass this but it turns out that he was using mouse button down events as well. I'll have to stick to them as well :)
peedalein
 
Posts: 54
Joined: Mon May 17, 2010 2:26 pm
Score: 1 Give a positive score

Re: Need help with Iphone game Controls..

Postby skydereign » Tue Nov 22, 2011 10:37 am

You can only have one mouse using the mouse enter. Since only one xmouse, ymouse instance is allowed, if you do use a mouse enter type actor for your move buttons, then your other actors need to be mouse button down actors. And to support even that, you have to do the DestroyActor CreateActor trick I mentioned earlier. So, as long as you only have a mouse button down jump event, you can still use mouse enter for your movement. But, since gE doesn't truly support multitouch (as in more than one mouse) that is the best you can do.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Need help with Iphone game Controls..

Postby peedalein » Tue Nov 22, 2011 11:30 am

Hi skydereign,

back to the topic :) where do I put exactly the destroy/create actor code?

I put it in my jump mouse button down code, so that I could the mouse enter movements but it did not change anything.
peedalein
 
Posts: 54
Joined: Mon May 17, 2010 2:26 pm
Score: 1 Give a positive score

Re: Need help with Iphone game Controls..

Postby Chai » Tue Nov 22, 2011 2:22 pm

peedalein,

Now I know what is your problem. You put the code as " player.x+=5;" directly on button, isn'i it.
In this case Mouse down Event will just work only one time when you press it
but Mouse enter event will run over and over. that why you like this event, right?
but you can't use mouse enter event as multi touch for iPhone.

However, you no need to put the code directly on the button.
Try this
put this code on button, [Mouse down event]
Code: Select all
Direction = 1;

I use 1 as right and 2 as left.

then put this code on the player actor.
Code: Select all
switch(Direction){
case 0: break;
case 1: x+=5;break;
case 2: x-=5; break;
}


p.s. when you use Mouse down event please use this even for every button for your game.
User avatar
Chai
 
Posts: 361
Joined: Sat Apr 30, 2005 2:26 pm
Location: Thailand
Score: 30 Give a positive score

Re: Need help with Iphone game Controls..

Postby peedalein » Tue Nov 22, 2011 3:16 pm

Hi chai,

actually that is not my problem :)

I have a mouse button down AND up event. The player 'clicks' the button and as long as his finger remains on the button, the actor keeps on walking. If the player
removes his finger from the button, the mouse button up event is triggered and the actor movement is stopped.

I guessed that this multitouch thing is not supposed to work by design therefore I am really looking forward to skydereigns explaination regarding

you have to do the DestroyActor CreateActor trick I mentioned earlier. So, as long as you only have a mouse button down jump event, you can still use mouse enter for your movement.


as it did not work for me.

Regards,
P
peedalein
 
Posts: 54
Joined: Mon May 17, 2010 2:26 pm
Score: 1 Give a positive score

Re: Need help with Iphone game Controls..

Postby RippeR7420 » Tue Nov 22, 2011 4:26 pm

I have found a way to bypass it :) when im done with your .ged file i will re-upload so you can check it
Out :D
CURRENT PROJECTS:

-Olo: The Sword Shaman http://game-editor.com/forum/viewtopic.php?f=4&t=12919

-The Wrath of Blob: (On the back burner)

-StickMcGee - Blast to the Future http://game-editor.com/forum/viewtopic.php?f=4&t=13660
User avatar
RippeR7420
 
Posts: 391
Joined: Mon Apr 27, 2009 4:16 pm
Location: Salt Lake City, Utah.
Score: 23 Give a positive score

Re: Need help with Iphone game Controls..

Postby skydereign » Tue Nov 22, 2011 8:32 pm

peedalein wrote:Hi skydereign,

back to the topic :) where do I put exactly the destroy/create actor code?

I put it in my jump mouse button down code, so that I could the mouse enter movements but it did not change anything.

As I mentioned, that code won't work well if you are trying to handle two instances of mouse enter. It would still exhibit some problems if you wanted the left and right sides to have mouse enter events. So, you'd still require it to be a mouse button down event for the jump, but the movement could use mouse enter. And, in case you are still curious about it (despite the lack of double mouse enter) you would put this code in the mouse button down.
Code: Select all
DestroyActor("Event Actor");
CreateActor(name, getAnimName(animindex), "(none)", "(none)", 0, 0, false);

You might need to parent it to the view, if your view is moving though. That'll make the positioning at (xscreen, yscreen) instead of (0, 0).
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Need help with Iphone game Controls..

Postby RippeR7420 » Wed Nov 23, 2011 1:20 am

Here ya go peedalein :)

http://www.megaupload.com/?d=CA7AUO4D

Now I haven't actually tested it on the iphone, But I used the same method that I am using in my current iphone game, and it works just fine for me. :)

What I did was create three actors; PlayerCollision, PlayerGround, PlayerJump.
I set PlayerCollision to be the Parent of both PlayerGround and PlayerJump. Whenever you player leaves the "Ground" you will have
this code:

JumpButton-> MouseButtonDown->ScriptEditor->

Code: Select all
if(JUMP==1)
{
        PlayerCollision.yvelocity=-12;
        JUMP=0;
        ChangeTransparency("PlayerGround", 1.000000);
        ChangeTransparency("PlayerJump", 0.000000);
}


and Use this code in;

PlayerCollision->AddEvent->Collision->TopSideOfGround->ScriptEditor->

Code: Select all
ChangeTransparency("PlayerGround", 0.000000);
ChangeTransparency("PlayerJump", 1.000000);


remember to add all of your Players Jump Animations to the "PlayerJump" actor, and the Running Animations to your "PlayerGround" actor. :)
you should be able to figure out the rest ;)

I know this method is not the best, but as long as you use all of your collision events on the PlayerCollision actor, You should be set!
if you have anymore questions, feel free to ask :)
CURRENT PROJECTS:

-Olo: The Sword Shaman http://game-editor.com/forum/viewtopic.php?f=4&t=12919

-The Wrath of Blob: (On the back burner)

-StickMcGee - Blast to the Future http://game-editor.com/forum/viewtopic.php?f=4&t=13660
User avatar
RippeR7420
 
Posts: 391
Joined: Mon Apr 27, 2009 4:16 pm
Location: Salt Lake City, Utah.
Score: 23 Give a positive score

Re: Need help with Iphone game Controls..

Postby peedalein » Wed Nov 23, 2011 9:55 am

Hi Ripper,

I tested your example on my ipod touch and it works the same way as my code did before.

-> Player touches left/right controls -> Actor moves -> Player presses jump button -> Actor jumps but left/right movement stops



@skydereign

As I mentioned, that code won't work well if you are trying to handle two instances of mouse enter.
It would still exhibit some problems if you wanted the left and right sides to have mouse enter events.
So, you'd still require it to be a mouse button down event for the jump, but the movement could use mouse enter.
And, in case you are still curious about it (despite the lack of double mouse enter) you would put this code in the mouse button down.


I was always using mouse enter/leave for movement and mouse button down/up for jump. Does the destroy actor event refer to the jump button or to the actor?

Thanks for all your help! I really appreciate it!
peedalein
 
Posts: 54
Joined: Mon May 17, 2010 2:26 pm
Score: 1 Give a positive score

Previous

Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest