-
isKeyDown Left Up Shift
isKeyDown Left Up Shift wont work if you use the right shift key, but isKeyDown Left Up Shift will work if I use the right shift key... What is up with this? LEFT DOWN Shift works Right Down Shift and Right Up Shift
Why is it only when LEFT UP AND SHIFT are pressed, SHIFT is not registered as being pressed..
-
function onEnterFrame() {
if (Key.isDown(Key.SHIFT)) {
if ((Key.isDown(Key.UP)||Key.isDown(Key.DOWN)) && Key.isDown(Key.LEFT)) {
trace("ppp");
}
}
}
Up wont work, ive tried to write this other ways too.
-
Designer, Programmer, Musician
Yup. There is an issue with the right shift. I used listeners
PHP Code:
var myListener = new Object(); myListener.onKeyDown = function() { if(Key.isDown(Key.SHIFT) && Key.isDown(Key.UP)) { trace("Combo:" + "SHIFT + UP"); if(Key.isDown(Key.SHIFT) && Key.isDown(Key.LEFT)) { trace("Combo:" + "SHIFT + UP + LEFT"); } }
} Key.addListener(myListener);
And it is like you say, everythings alright with the left SHIFT, but not with the right one.
If I press SHIFT + UP, ok, but if I press SHIFT + UP + LEFT, nothing happens. Then if I press LEFT + UP first and quickly press SHIFT, then It responds... I think it has to do with some Windows system's keyboard shortcuts...altought I checked the flash internal shortcuts and the only conflicting shorcut was CNTRL + SHIFT + UP and i disabled it...
I will read on internet to see what's up
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
-
Originally Posted by angelhdz
Yup. There is an issue with the right shift. I used listeners
PHP Code:
var myListener = new Object();
myListener.onKeyDown = function()
{
if(Key.isDown(Key.SHIFT) && Key.isDown(Key.UP))
{
trace("Combo:" + "SHIFT + UP");
if(Key.isDown(Key.SHIFT) && Key.isDown(Key.LEFT))
{
trace("Combo:" + "SHIFT + UP + LEFT");
}
}
}
Key.addListener(myListener);
And it is like you say, everythings alright with the left SHIFT, but not with the right one.
If I press SHIFT + UP, ok, but if I press SHIFT + UP + LEFT, nothing happens. Then if I press LEFT + UP first and quickly press SHIFT, then It responds... I think it has to do with some Windows system's keyboard shortcuts...altought I checked the flash internal shortcuts and the only conflicting shorcut was CNTRL + SHIFT + UP and i disabled it...
I will read on internet to see what's up
this doesn't work either does it?
-
.
Hi,
Try doing it whilst the shift key is down on its own first, like so
PHP Code:
var KeyListener = new Object();
KeyListener.onKeyDown = function()
{
if (Key.isDown(Key.SHIFT))
{
if (Key.isDown(Key.UP) && Key.isDown(Key.LEFT))
{
trace("Pressing:" + "SHIFT + UP + LEFT");
}
if (Key.isDown(Key.UP) && Key.isDown(Key.RIGHT))
{
trace("Pressing:" + "SHIFT + UP + RIGHT");
}
//trace("Key:" + "SHIFT");
}
};
Key.addListener(KeyListener);
-
This was my original code,
PHP Code:
function playeraction() {
func_action();
_level0.gui_player_stats.hp._xscale = player[Energy];
if (!player[Pause]) {
if (player1._visible == true) {
player1.swapDepths(player1._y);
settings[Energy_degrade_tmp] = 0.1;
player[Final_speed] = player[Initial_speed];
if (Key.isDown(Key.SHIFT)) {
if (player[Energy]>30) {
settings[Energy_degrade_tmp] = 0.2;
player[Final_speed] = player[Initial_speed]*2;
}
}
if (Key.isDown(37) && level.area.hitTest(player1._x+player[Final_speed]-settings[1], player1._y, true)) {
player[Last_position] = 2;
player1.gotoAndStop(4);
player1._x -= player[Final_speed];
settings[Energy_degrade] = settings[Energy_degrade_tmp];
} else {
if (Key.isDown(39) && level.area.hitTest(player1._x+(player1._width-player[Final_speed])+settings[1], player1._y, true)) {
player[Last_position] = 1;
player1.gotoAndStop(3);
player1._x += player[Final_speed];
settings[Energy_degrade] = settings[Energy_degrade_tmp];
}
}
if (Key.isDown(38) && level.area.hitTest(player1._x+(player1._width/2), player1._y-player[Final_speed], true)) {
player1._y -= player[Final_speed];
settings[Energy_degrade] = settings[Energy_degrade_tmp];
} else {
if (Key.isDown(40) && level.area.hitTest(player1._x+(player1._width/2), player1._y+player[Final_speed], true)) {
player1._y += player[Final_speed];
settings[Energy_degrade] = settings[Energy_degrade_tmp];
}
}
if (!Key.isDown(37) && !Key.isDown(39)) {
player1.gotoAndStop(player[Last_position]);
}
if (player[Energy]>1) {
player[Energy] = player[Energy]-settings[Energy_degrade];
settings[Energy_degrade] = 0;
} else {
player[Pause] = true;
player1.gotoAndStop(4+player[Last_position]);
}
}
}
}
-
.
Hi,
It would be nice to have the file as it will take a while to try and emulate your file, or at least a slimmed down version.
And which part you are having the problem with!
-
the file is 2mb, I can include a link here www.LoveRevolution.Ca/game/tst_arranged.fla
When you press up and left, the turtle walks on a diagonal, but shift wont make him run. but if you are running then up and left wont work, only up or left. not sure why. Also if you have any suggestions on the way that I made the file, let me know
Last edited by brickhouse420; 11-13-2013 at 12:26 PM.
Reason: added info
-
.
Link not working, opens the fla in the browser, code
-
it downloaded it in chrome, anyways here is the folder www.LoveRevolution.Ca/game try right click save as?
-
.
Hi,
Well from looking around and playing it to test, it seems that the turtle is able to run using the shift key until his energy gets below 30, if you change
PHP Code:
if (player[Energy] > 30)
{
settings[Energy_degrade_tmp] = 0.2;
player[Final_speed] = player[Initial_speed] * 2;
}
to
PHP Code:
if (player[Energy] > 0)
{
settings[Energy_degrade_tmp] = 0.2;
player[Final_speed] = player[Initial_speed] * 2;
}
then you can run continuously, perhaps its your end as it runs here fine.
-
then you can run continuously, perhaps its your end as it runs here fine.
Well the point was for your guy to be tiered under 30, and then he eventually takes a rest. Do you think it's better to have 0 instead of 30? I liked the run, then walk then sleep. as opposed to running and sleeping.
Also you can run while pressing up and left?
What do you think about how i set the file up, programed it and so forth? Any suggestions?
-
Designer, Programmer, Musician
Originally Posted by brickhouse420
Well the point was for your guy to be tiered under 30, and then he eventually takes a rest. Do you think it's better to have 0 instead of 30? I liked the run, then walk then sleep. as opposed to running and sleeping.
Also you can run while pressing up and left?
What do you think about how i set the file up, programed it and so forth? Any suggestions?
I FOUND OUT THE POSSIBLE ISSUE!!!
I think it has something to do with the keyboard. I tried Fruitbeard's script, and my posted script on my laptop, and the issue disappeared!!!! Now it works if I press SHIFT first and then UP+LEFT, or if I press UP+ LEFT first and then the SHIFT key. So, I can't say 100%, but i think is the desktop ps/2 keyboard...(i have a ps/2 keyboard with my desktop computer) I will try with my USB keyboard when i get home.
Good luck!
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
-
Originally Posted by angelhdz
I FOUND OUT THE POSSIBLE ISSUE!!!
I think it has something to do with the keyboard. I tried Fruitbeard's script, and my posted script on my laptop, and the issue disappeared!!!! Now it works if I press SHIFT first and then UP+LEFT, or if I press UP+ LEFT first and then the SHIFT key. So, I can't say 100%, but i think is the desktop ps/2 keyboard...(i have a ps/2 keyboard with my desktop computer) I will try with my USB keyboard when i get home.
Good luck!
Well I am not sure if its a ps2 keyboard problem or not, All I know is that I am using it on a laptop.
I just realized that the code works with my laptops left shift but not with its right shift, which I have been using right shift the whole time. Not sure why one shift works but not the other? The right shift works, but just not when I am using up and left as well.
(If any one has any other suggestions about optimizing my game code let me know)
-
Maybe you can post an example of the player code with one that works? or perhaps its just an issue on my end like fruitbread said.
Also, I am aware of the continuous run, I prefer that you are able to run until your energy is less then 30, then you walk for a bit. then you run out of energy. Maybe its better just to have it as 0? Perhaps my way could be considered annoying lol
-
actually if I open on screen keyboard hold up left and press left shift, it shows shift being pressed but if I hold up left and press right shift it does not show shift being pressed. Something is wrong with my laptop I guess.
-
Designer, Programmer, Musician
I understand your problem brickhouse420, in my pc i had issues with the RIGHT SHIFT key too.
Now in my laptop I didn;'t have any issue, with my script, neither with fruitbeard;s script...and now you say you are using a laptop...so my last words are...maybe you in your laptop, and me on my computer, maybe we have some program or plugin interfering with the keyboard's keys /shortcuts...I will be making some test when i get home...
But now you can be relieved, knowing that there is nothing wrong with our scripts. Good luck
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
-
Originally Posted by angelhdz
But now you can be relieved, knowing that there is nothing wrong with our scripts. Good luck
you are saying our scripts, but does that mean mine is ok as well? I didn't see an error with mine. So I am assuming all three of ours is good and with out error.
-
.
Hi,
I only mentioned the energy field because it might have been that which made your turtle not run and you were not aware of it, it seems you are, the running out of energy is probably better as its more realistic but it all happens too quickly.
For the game I didn't really know what was going on, nor did anything seem to happen and it all happened so quickly, I would like some info at the start, a brief outline (instructions maybe).
The keys did work here, so I can only assume that you have some hardware issues or conflicting software issues, I don't know?
It gave errors when testing at this end on the initial variables layer code, so you might want to run through that section again, i don't think it liked the comments inside the arrays!!
are you called Eric?
-
Originally Posted by fruitbeard
Hi,
I only mentioned the energy field because it might have been that which made your turtle not run and you were not aware of it, it seems you are, the running out of energy is probably better as its more realistic but it all happens too quickly.
For the game I didn't really know what was going on, nor did anything seem to happen and it all happened so quickly, I would like some info at the start, a brief outline (instructions maybe).
The keys did work here, so I can only assume that you have some hardware issues or conflicting software issues, I don't know?
It gave errors when testing at this end on the initial variables layer code, so you might want to run through that section again, i don't think it liked the comments inside the arrays!!
are you called Eric?
Hello, yes I am Eric. (Excuse the user name).
The game is just in a testing part, so there isn't the story added yet, and that isn't the starting level either. It's a demo at the moment, and starts like that so it's easier to test. I'll make the energy run out 2.5 times slower.
There actually isnt much in the game, just a few shows you can buy things from when you press space at the characters, and a quest to deliver mail lool. There are some errors in this file as I re-arranged all the code, and changed most of the variables to a giant array. I have to fix some more errors.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|