Page 1 of 1

is this a bug or is it me???

PostPosted: Sat May 28, 2011 3:17 pm
by sonicfire
can anybody help me? please check the attached game demo.
you can move the player via the arrow keys which works fine.

however! try using the onscreen arrows (click them).
you will see the player isnt moving at all?? why?
i´m triggering the SAME function - so he should move, no ??

this is so weird, can anybody help me?? please ? :)

mrtwo.rar
(247.49 KiB) Downloaded 86 times

Re: is this a bug or is it me???

PostPosted: Sat May 28, 2011 4:06 pm
by savvy
why are you using such a scew-iff way of doing this? lol just use a direction variable, then on the player use if animindex!= to change its animation. using void for this is a really awkward thing to do. so yeah, just use a variable instead of the void function and it should work perfectly.

savvy

Re: is this a bug or is it me???

PostPosted: Sat May 28, 2011 4:11 pm
by sonicfire
perhaps you´re right :oops:
just tried the movecode directly upon mouse button down instead of putting it into a function ... and guess what, player moves correctly.
i still only dont understand why it did not work before :?

Re: is this a bug or is it me???

PostPosted: Sat May 28, 2011 4:28 pm
by savvy
perhaps the switch wasnt working properly :P

Re: is this a bug or is it me???

PostPosted: Sun May 29, 2011 1:09 am
by skydereign
Okay, chances are it is the global code actor variable problem. Essentially global code can't access other actor's actor variables unless the event code has some reference to the actor. For example, this will not turn the player actor red.
Global Code
Code: Select all
void
colorActor ()
{
    player.r=0;
    player.g=0;
    player.b=0;
}


view -> KeyDown r (disabled) -> Script Editor
Code: Select all
colorActor();


But this code will.

view -> KeyDown r (disabled) -> Script Editor
Code: Select all
// player
colorActor();


So if you use any instances of actorName.actorVar it won't work unless in the event that calls the global code you reference actorName in some way. I can't tell if that is the case here as the file I guess was emptied, but that might be the problem you are having.

Re: is this a bug or is it me???

PostPosted: Sun May 29, 2011 1:03 pm
by sonicfire
ah, i remember! that was the problem i once had also... thanks!! :)