keyboard keys wont work when Player in player box

Just started using Construct 2? Post your questions here

Post » Thu Apr 06, 2017 10:09 am

Ive never used the tutorial before with anims, but i setup the platform demo, which basically gets you to put the player (sprite) in a playerbox so as to get it to work properly for anims etc amongst other things. Ive also setup spacebar as a simulated jump key. My problem is, is that if i enable the "Every tick->keep player(sprite) on playerbox" in event sheet, it disables the spacebar simulated key and also any other key that i might setup instead.?? but the arrow keys work fine reguardless as standard with construct for movement. As soon as i disable the keep player (sprite) on playerbox the space works again too...really odd.
I only discovered this, because i could not understand why the anims was stopping etc at random and going into debiug i saw the playerbox, loosing the position of playersprite it was all over the place. Missed this in tutorial.:) So as above though, I cant understand why the keyboard is getting disabled when i enable keep player to box with the system tick.?
I looked at the two other questions on this in forum but this really did not give me an answer?
Im running windows 10 64bit v1607. Ive tested this using all browsers preview and also NW.js same problem. Im running Construct 2 release 243. 64bit.
I guess im doing something wrong but i dont know what?
B
6
S
1
Posts: 14
Reputation: 878

Post » Thu Apr 06, 2017 4:46 pm

I'm a little confused by how you've worded your problem, but I'll throw some advice, see if it sticks.

If you're trying to keep an object on top of another object, I would recommend trying the "pin" behavior. Put pin on the object that DOESN'T accept input, and at the start of the layout, set its position to the object that DOES accept input and set the pin. Then put your arrow keys/space bar input on the object without the pin.

Pin automatically sets position/angle according to the object it was pinned to. Hope that helps!
B
18
S
3
G
3
Posts: 82
Reputation: 2,543

Post » Fri Apr 07, 2017 6:32 am

mm ok thx, ill try this as well....Yes, for now, ive simply just removed the playerbox as suggested in the tutorial and used just the player sprite and connected anims and keys/space to it and it works fine. it does say in the tutorial that, (Pages 4 + 5) https://www.scirra.com/tutorials/253/ho ... ame/page-4 that one should use it though the playerbox, but as soon as i set it move with the playersprite as in the tutorial using the system tick interrupt event it would not move with a spacebar key setup to jump as well as above only the arrow keys would make it jump, really odd. Ill try the pin and see how i go as an option then.
B
6
S
1
Posts: 14
Reputation: 878

Post » Fri Apr 07, 2017 9:46 am

Do you have the platform behavior attached to both ? To box & animation ?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Apr 07, 2017 4:49 pm

Oh wow. Okay. That tutorial is from 2012. Holy crap.

So instead of making the object reposition to the empty box every tick, instead, use the pin behavior as I explained above. Try putting the platform behavior on both, but with Pin I don't actually think that's a good idea, as at best the Pin will make the game ignore the animation's jump behavior, and at worst, it will double jump for every press.
B
18
S
3
G
3
Posts: 82
Reputation: 2,543


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests