Need help with Iphone game Controls..

Game Editor comments and discussion.

Need help with Iphone game Controls..

Postby RippeR7420 » Thu Nov 03, 2011 10:48 pm

So I have diagnosed my problem, but I just need some help to fix it :)
I'm gonna try to explain it the best I can. Here it goes..

So, I have it set up to move my player Left, Right, and Jump. I can get him to run Left/Right smoothly using MouseEnter/MouseLeave, But when I try to incorporate
the jump in, I cant get the jump animation AND the x+/x- to work at the same time. ( it's either one or the other)..:( My guess is that is has something to do with when you use the KeyDown event, is has a Repeat option.. As the MouseEnter/MouseButtonDown do not. is there someone out there who can help me?
Hope I explained it good enough.

Thanks! and +1 :)
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 SuperSonic » Thu Nov 03, 2011 11:03 pm

Could you post the code? :)
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Need help with Iphone game Controls..

Postby skydereign » Thu Nov 03, 2011 11:50 pm

Chances are you are running into the multitouch limitation gE has. gE only supports a single mouse (xmouse, ymouse). So if you are using mouse enter for the movement, and then you click jump, the xmouse and ymouse change to the new clicked position. One way I found to avoid this is to have mouse button down event for the jump button to destroy itself, and recreate it. This will remove the tracking of the second mouse click.
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 Fojam » Fri Nov 04, 2011 1:26 am

i have found ways to fight the whole multitouch limitation

here is my code for the left mouse button down
Code: Select all
if(gamePlaying==1)
{
    if(moveRight==1)
    {
        moveRight=0;
        moveLeft=1;
        ChangeAnimation("man", "man_run_left", NO_CHANGE);
    }
    else
    {
        moveLeft=1;
        ChangeAnimation("man", "man_run_left", NO_CHANGE);
    }
}
ChangeAnimation("button_left", "button_left_selected", NO_CHANGE);

mouse button left up
Code: Select all
moveLeft=0;
if(moveRight==0)
{
    ChangeAnimation("man", "man_stand", NO_CHANGE);
}
ChangeAnimation("button_left", "button_left", NO_CHANGE);
CLICK TO GIVE ME POINTS

My Latest Projects:
Super Smash Bros: viewtopic.php?f=6&t=12307 PLEASE help by making sprites!
User avatar
Fojam
 
Posts: 513
Joined: Thu Mar 19, 2009 10:02 pm
Location: under your bed!!!
Score: 69 Give a positive score

Re: Need help with Iphone game Controls..

Postby Hblade » Fri Nov 04, 2011 2:13 am

Perhaps:
Code: Select all
else
    {
        moveLeft=1;
        ChangeAnimation("man", "man_run_left", NO_CHANGE);
    }


:P You have Else, and it makes the same code cept for the animation
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Need help with Iphone game Controls..

Postby skydereign » Fri Nov 04, 2011 3:40 am

Fojam, that is using a supported form of multitouch. Therefore it does not bypass the problems we have with multitouch. Multiple mouse button down/up events are supported, the problem gE has is the single mouse variables. So, you can have several buttons, but for instance, you can't have two joysticks. But, with the DestroyActor, you can use a joystick and a single button, where without it you couldn't.
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 » Fri Nov 04, 2011 4:46 am

Thanks for the replies guys! :)

Hey Sky, How did you get it to work your way?

I tried this:


On the JUMP button: Add->MouseButtonDown->SciptEditor->

Code: Select all
switch(STATE)
{
    case 0:
    ChangeAnimation("Stik", "StikJumpRight", NO_CHANGE);
    StikCollision.yvelocity=-13;
    STATE=4;
    break;
 
    case 1:
    ChangeAnimation("Stik", "StikJumpLeft", NO_CHANGE);
    StikCollision.yvelocity=-13;
    STATE=5;
    break;
 
    case 2:
    ChangeAnimation("Stik", "StikJumpRight", NO_CHANGE);
    StikCollision.yvelocity=-13;
    STATE=4;
    break;
 
    case 3:
    ChangeAnimation("Stik", "StikJumpLeft", NO_CHANGE);
    StikCollision.yvelocity=-13;
    STATE=5;
    break;
 
    case 4:
    break;
 
    case 5:
    break;
 
    case 6:
    break;
 
    case 7:
    break;
 
    case 8:
    break;
 
    case 9:
    break;
 
    case 10:
    break;
 
    case 11:
    break;
 
    case 12:
    break;
 
    case 13:
    break;
}

DestroyActor("Event Actor");


Now, I know this isn't the way to do it. I just don't know how to "ReCreate" it haha :)

also, Will this STATE method not work?

Thanks again for the Help! I don't know what I would do without you guys haha! :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 » Fri Nov 04, 2011 5:36 am

Well, you have create the same actor in the same spot, so just add a CreateActor event, and make it appear at (0,0) setting the absolute position to false. And as long as STATE is a global variable, then it'll work.
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 » Fri Nov 04, 2011 3:51 pm

+1:)

so heres what I got now.

I have my Jump set up in draw actor to change my animation, but the yvelocity=-12; is throwing my gravity off balance.
I tried to put the yvelocity=-12; in the MouseDownEvent on my JumpButton, but my character wont jump haha.

here is my DrawActor Script:


case 12 and case 13 are what I set as jump for now..


Code: Select all
switch(STATE)
{
    case 0:
    ChangeAnimation("Stik", "StikStandRight", FORWARD);
    STATE=0;
    break;
 
    case 1:
    ChangeAnimation("Stik", "StikStandLeft", FORWARD);
    STATE=1;
    break;
 
    case 2:
    ChangeAnimation("Stik", "StikRunRight0001", NO_CHANGE);
    StikCollision.x+=4;
    STATE=2;
    break;
 
    case 3:
    ChangeAnimation("Stik", "StikRunLeft0001", NO_CHANGE);
    StikCollision.x-=4;
    STATE=3;
    break;
 
    case 4:
    if(yvelocity>0)
    {
        ChangeAnimation("Stik", "StikFallRight", NO_CHANGE);
        STATE=6;
    }
    break;
 
    case 5:
    if(yvelocity>0)
    {
        ChangeAnimation("Stik", "StikFallLeft", NO_CHANGE);
        STATE=7;
    }
    break;
 
    case 6:
    break;
 
    case 7:
    break;
 
    case 8:
    break;
 
    case 9:
    break;
 
    case 10:
    break;
 
    case 11:
    break;
 
    case 12:
    ChangeAnimation("Stik", "StikJumpRight", FORWARD);
    STATE=12;
    break;
 
    case 13:
    ChangeAnimation("Stik", "StikJumpLeft", FORWARD);
    STATE=13;
    break;
}

if(yvelocity>3)
{
    if(STATE%2==1)
    {
        ChangeAnimation("Stik", "StikFallLeft", NO_CHANGE);
        STATE=7;
    }
    else
    {
        ChangeAnimation("Stik", "StikFallRight", NO_CHANGE);
        STATE=6;
    }
}
yvelocity++;


and this is my MouseButtonDownEvent Script:

Code: Select all
if(STATE==2)
{
    STATE=12;
}

else

if(STATE==0)
{
    STATE=12;
}

else

if(STATE==3)
{
    STATE=13;
}

else

if(STATE==1)
{
    STATE=13;
}


I know this code is messy as all hell, but so far its the way I have to make multitouch work for me..
any advice would be amazing and very much appreciated! :) :) :)
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 RippeR7420 » Fri Nov 04, 2011 11:34 pm

So does the forum uploader not work anymore or somethin?
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 » Sat Nov 05, 2011 5:18 am

The forum uploader works for some browsers... It should work with the latest firefox though. But, the problem you are having sounds like your setting the wrong yvelocity. The button down event belongs to your button. That means yvelocity is the button's yvelocity. If you want to change the player's you should use player.yvelocity. Though you would see the button move. Anyway, since you are using the state system, you can change your mouse button down event to have this code.
Code: Select all
switch(STATE)
{
    case 0:
    case 2:
    STATE=12;
    break;

    case 1:
    case 3:
    STATE=13;
    break;
}
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 » Sun Nov 20, 2011 8:11 pm

Hi!

Ripper, I have the same problem, so I am kind of using your thread. Hope, that is ok :)

My actor is supposed to move in 3 directions - left - right - jump. I'd like to use MouseEnter Events for left - right.
They work fine unless the player uses the jump button which is a Mouse Button Down Event. The actor moves right or left. Once the jump button is pressed the x movement of the player stops.

I tried following skydereign's advice to destroy the jump button but it did not work. The problem persists.
This is the code I use (it is not the best programming style I know :)).

Thanks for any help :)


Right Direction Button Mouse Enter (For left direction it is basically the same, therefore I don't post it)

Code: Select all
if(Pause==0)


{ChangeAnimation("Rightbutton", "rightbuttoninactive_neu_small", FORWARD);};
MouseEnter = 1;


if (Pause == 0) {MinisterMove = 1;};


Right Direction Button Mouse Leave

Code: Select all
if (Pause == 0) {ChangeAnimation("Rightbutton", "rightbuttoninactive_small", FORWARD);
                };

if (Pause == 0) {MinisterMove = 0;
    ChangeAnimation("Minister", "financeminister_standing_small", FORWARD);
 
    MouseEnter = 1;
 

MinisterStop = 0;
MinisterDirec = 0;};


Jump Button Mouse Button Down

Code: Select all
if (Pause == 0) {ChangeAnimation("Event Actor", "jumpbuttoninactive_neu_small", FORWARD);
                };


if (Pause == 0) {

if(jump==1)
{
Minister.yvelocity=-16;
jump=0;
}


MinisterJump = 1;
    switch(MinisterDirec)
    {
 
 
        case 0:
        ChangeAnimation("Event Actor", "financeminister_stand_jump_small", FORWARD);
        break;
 
        case 1: //If previous animation was charLeft.
        ChangeAnimation("Event Actor", "financeminister_r_jump_small", FORWARD);
        break;
 
        case 2:
        ChangeAnimation("Event Actor", "financeminister_l_jump_small", FORWARD);
 

break;
 
    };


DestroyActor("Event Actor");
CreateActor("Jumpbutton", "jumpbuttoninactive_small", "(none)", "(none)", 312, 292, true);

                };



Jump Button Mouse Button Up
Code: Select all
 
if (Pause == 0) {
 
    ChangeAnimation("Event Actor", "jumpbuttoninactive_small", FORWARD);
                };
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 » Sun Nov 20, 2011 10:56 pm

Alright i dont know if going to be able to explain very well, but you upload you .ged file
I will fix it for you how i fixed mine:) or when i get around my comp i will try to post the code
to help:)
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 » Mon Nov 21, 2011 12:23 pm

Hi Ripper,

this is the file. Feel free to fool around with it :)
Attachments
iphonecontrols.zip
(153.43 KiB) Downloaded 104 times
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 » Mon Nov 21, 2011 12:43 pm

Well...

Why do not separate button become 2 parts on the screen.
First, is the big area for run or walk to left and right for you mouse, but you need keep space for the jump button
Second, Jump button. not put over the first button.
User avatar
Chai
 
Posts: 361
Joined: Sat Apr 30, 2005 2:26 pm
Location: Thailand
Score: 30 Give a positive score

Next

Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest