anykey/mouse button down not behaving as expected

Game Editor comments and discussion.

anykey/mouse button down not behaving as expected

Postby edh » Sun Feb 10, 2008 4:28 am

I wrote a little test to demonstrate some unexpected behavior.

I want to display a region, then when the user presses any key, or clicks the mouse button, I want to move the view to another region. The idea is something like a splash screen or dialog which has to be "acknowledged" in some way.

There are two regions, with different text actors ("screen 1", and "screen 2"); and a third text actor to just report events.

Anyway, it isn't working as expected. This file has three behaviors:
1) any key moves view.y+=480 in it's own script action
2) left mouse button on the text does the same in it's own script action
3) right mouse button calls a global function to change the view.y+=480

pressing any key takes me to a blank screen.
left clicking the screen 1 text takes me to screen 2, which is what I would expect.
right clicking screen 1 doesn't seem to call the global function at all, and nothing happens. The text actor doesn't even get changed.


I have GE Pro v1.3.9 (I think it was actually 1.3.9a).

Can anyone explain this to me?
Attachments
screentest.zip
screen test source .ged and data
(116.17 KiB) Downloaded 75 times
User avatar
edh
 
Posts: 233
Joined: Thu Sep 13, 2007 12:17 am
Location: Maine, USA
Score: 14 Give a positive score

Re: anykey/mouse button down not behaving as expected

Postby DilloDude » Sun Feb 10, 2008 5:39 am

If you want to access another actor in a global function, you need some reference to it in the calling action.
Code: Select all
//view
globalFunction();

If you're going to have a global function, it's best to make all events do the same thing. That way, if you wan't to change it, you only have to change one place.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Re: anykey/mouse button down not behaving as expected

Postby edh » Sun Feb 10, 2008 6:50 am

@Dillo : thanks, that helped the right click action. I also changed the keydown to make the same exact call as the right click

Code: Select all
//view
change_screen();


where change_screen() looks like
Code: Select all
void change_screen()
{
    view.y+=240;
}


The right click works, takes me to the screen 2 view; key down (any key) still takes me to a black screen. I can't figure out why the same function doesn't give the same behavior.
User avatar
edh
 
Posts: 233
Joined: Thu Sep 13, 2007 12:17 am
Location: Maine, USA
Score: 14 Give a positive score

Re: anykey/mouse button down not behaving as expected

Postby DilloDude » Sun Feb 10, 2008 9:44 am

Do you have repeat disabled on the key-down? If you don't, you'll usually move way past the correct point.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Re: anykey/mouse button down not behaving as expected

Postby edh » Sun Feb 10, 2008 3:02 pm

@Dillo : that was it!

Thanks DilloDude
User avatar
edh
 
Posts: 233
Joined: Thu Sep 13, 2007 12:17 am
Location: Maine, USA
Score: 14 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron