Page 1 of 1

anykey/mouse button down not behaving as expected

PostPosted: Sun Feb 10, 2008 4:28 am
by edh
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?

Re: anykey/mouse button down not behaving as expected

PostPosted: Sun Feb 10, 2008 5:39 am
by DilloDude
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.

Re: anykey/mouse button down not behaving as expected

PostPosted: Sun Feb 10, 2008 6:50 am
by edh
@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.

Re: anykey/mouse button down not behaving as expected

PostPosted: Sun Feb 10, 2008 9:44 am
by DilloDude
Do you have repeat disabled on the key-down? If you don't, you'll usually move way past the correct point.

Re: anykey/mouse button down not behaving as expected

PostPosted: Sun Feb 10, 2008 3:02 pm
by edh
@Dillo : that was it!

Thanks DilloDude