Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Help: Climbable and Abilities #170

Closed
leoportilho opened this issue Jul 17, 2014 · 1 comment
Closed

Code Help: Climbable and Abilities #170

leoportilho opened this issue Jul 17, 2014 · 1 comment

Comments

@leoportilho
Copy link

Hi there!

Collin thx very much for this library, it's amazing how fast I'm configuring the game (I can't say "programming" coz thats not what I'm doing right now lol)

I did all the basic tutorials and had no problem, the documentation is amazing, but I had very few issues that I solved by reading the suppercollider and jumpnrun samples.

Now I want to do some custom stuffs, but I'm complete newbie. Thats why I need some help, I dont want any code, just some logics behind them.

I want to try something like kid chameleon, the player changes costumes and powers depending of the helmet picked. Kid can climb and slide in walls, can fly, can double jump, can run faster, can be a samurai.

I know that Impact++ is the one to me, but I still need some studying.

What I intend to do:

Flying ability: My problem is what do I have to extend? I thought I could only change GravityFactor to 0 and thats all.

Climbing ability: I want to extend Shape-Climbable, put it near a wall to make possible to climb like Kid, but I want to change the fact that the player can walk out of the wall. If the player is climbing and press right/left the animation should change to one hand grabbed version. Only leaves the wallclimbing by jumping.

Wall Sliding: Same thing as before, but this time the player slides down slowly.

How to change abilities? Press tab, ability A activated, press again ability B. It's in the main or in the player that I have to code?

Change Animation Sprites after changing abilities?

Thx for the help guys!

@collinhover
Copy link
Owner

For changing abilities through player input, check out the player's handle input method: https://github.com/collinhover/impactplusplus/blob/master/lib/plusplus/abstractities/player.js#L156

For changing animations, you can do that by changing the sprite sheet in the entity's updateChanges method, after you've checked what ability is active. You may need some custom code to change the sprite sheet, but I know several people have done it before. Search the impact forums for ideas on that.

For flying, it should work to set the gravity factor to 0, that is how it is done for the ghost in the run n jump demo. Is this not working for you? You may need to reset the velocity of the entity as well.

For climbing and hanging off the wall with one hand, I don't know where I'd start. That is very specific to your game.

For wall sliding, you'll need to add that behavior to your entity and probably change the friction while the entity if colliding with a wall horizontally. I think the collision map result may help you determine that, see https://github.com/collinhover/impactplusplus/blob/master/lib/plusplus/core/entity.js#L169.

Hope this helps you get started!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants