Player Programming


#1

I’m Currently Creating another type of player that uses Frogatto code but with different keys and image. When ever I place the object it replaces the old frogatto on the stage. I also can’t seem to change the keys with out editing the default keys please help!
It also fails to read the image…


#2

The editor enforces ‘only one player’, at the moment. More than one player would be multiplayer, and multiplayer is played over the internet, and that’s not hardly supported at all at the moment.

To switch around the keys, you’ve probably seen that there’s code in the events like [tt]on_ctrl_left[/tt] or whatever they are. That event is fired by the engine whenever you hit the key you’ve set as the left control. However, there is a way around this – you can check the [tt]ctrl_keys[/tt] variable in the playable object. (ie, [tt]level.player.ctrl_keys[/tt]). This will return a list of all the keys currently pressed. So, [tt]if(‘a’ in level.player.ctrl_keys, debug(‘left’))[/tt] would print ‘left’ whenever you are holding the a key down. That’s ? of the wasd cluster there. The downsides are that not everyone uses qwerty keyboards and it’s not configurable anymore from the escape menu.

It can’t read the image? That’s another can of worms, Agameofscones.


#3

Too bad only one player. Thats however exactly what I’m trying to work around. I’m trying to develop a none internet based CO-OP mode. No split screen D:. I working on sprite sheets currently and am making Frogatto Blue. But thanks for telling me how to change the keys. So To change the keys for the second Frogatto it would be in stead of ctrl_left I would change it to ctrl_a right? But just getting the second player able to walk (but still be the only player on the screen D:) Would be pretty cool. Thats alot of code to mess around with. But I guess I can try!

P.S. I figured out how to make the object read the CORRECT sprite sheet.


#4

The object read the correct sprite sheet, its just that the animations read from a different sprite sheet.


#5

Screenshots might be helpful at this point.


#6

I tried making a second player by changing the code. :’( It was an utter failure and I ended up damaging the code :frowning: I however had a back up of the code :D. I think I might stop attempting because is to hard :(.


#7

:frowning: it is.