Page 2 of 2

Re: Need help with Iphone game Controls..

PostPosted: Mon Nov 21, 2011 3:41 pm
by peedalein
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 :)

Re: Need help with Iphone game Controls..

PostPosted: Tue Nov 22, 2011 1:40 am
by Chai
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?

Re: Need help with Iphone game Controls..

PostPosted: Tue Nov 22, 2011 6:31 am
by peedalein
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 :)).

Re: Need help with Iphone game Controls..

PostPosted: Tue Nov 22, 2011 7:36 am
by Chai
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.

Re: Need help with Iphone game Controls..

PostPosted: Tue Nov 22, 2011 10:33 am
by peedalein
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 :)

Re: Need help with Iphone game Controls..

PostPosted: Tue Nov 22, 2011 10:37 am
by skydereign
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.

Re: Need help with Iphone game Controls..

PostPosted: Tue Nov 22, 2011 11:30 am
by peedalein
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.

Re: Need help with Iphone game Controls..

PostPosted: Tue Nov 22, 2011 2:22 pm
by Chai
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.

Re: Need help with Iphone game Controls..

PostPosted: Tue Nov 22, 2011 3:16 pm
by peedalein
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

Re: Need help with Iphone game Controls..

PostPosted: Tue Nov 22, 2011 4:26 pm
by RippeR7420
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

Re: Need help with Iphone game Controls..

PostPosted: Tue Nov 22, 2011 8:32 pm
by skydereign
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).

Re: Need help with Iphone game Controls..

PostPosted: Wed Nov 23, 2011 1:20 am
by RippeR7420
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 :)

Re: Need help with Iphone game Controls..

PostPosted: Wed Nov 23, 2011 9:55 am
by peedalein
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!