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

Make arrows and spears bury into the ground #47

Closed
nwinter opened this issue Jan 2, 2014 · 7 comments
Closed

Make arrows and spears bury into the ground #47

nwinter opened this issue Jan 2, 2014 · 7 comments

Comments

@nwinter
Copy link
Contributor

nwinter commented Jan 2, 2014

When arrows/spears get stuck in the ground, they should appear buried in the ground. We have a die animation that cuts off the points, but we aren't 1) using it or 2) adjusting the rotation to make them point down into the ground.

Our arrow die state:

screenshot 2014-01-02 13 43 22

When an arrow misses and lodges into the ground, it should look kind of like this:

screenshot 2014-01-02 13 47 48

Adding the "die" action

In the combat.Arrow Component (edit the code in the level editor), which serves for both Arrow and Spear ThangTypes, do something like what the combat.Shell Component does to set the action to "die" when the missile gets stuck in the ground. That should trigger the die action animation in the CocoSprite. We'll also need to add the action.Acts Component to the Thang. (I can add that to the Arrow and Spear ThangType default Components when it's ready.)

Pointing into the ground

See #46 for some info on adjusting the apparent rotation / skew / transform properties in general. We'd want to adjust those also so that the arrows and spears appear to be buried in the ground, even though their velocity and rotation may no longer be meaningful (as they're not moving). So you'd add code in app/lib/surface/CocoSprite.coffee in perhaps the updateRotation or updateAction methods.

@kgy01
Copy link
Contributor

kgy01 commented Mar 18, 2014

I'm working on this issue.

@kgy01
Copy link
Contributor

kgy01 commented Mar 21, 2014

I need some help with this issue.
combat.Arrow already has setAction 'die' and act true in its update function, which sets its action to die. The die state is displayed if action.Acts component is added to the Arrow thang, but an unexpected shadow(?) appears under the dead arrow sprites.
Should I refactor that and move this setAction functionality into a chooseAction function?

@nwinter
Copy link
Contributor Author

nwinter commented Mar 21, 2014

Hmm, it seems like we need to add some code to stop drawing the shadow for arrows and spears that are dead, which we could try out in CocoSprite by checking if the ThangType name is "Arrow" or "Spear". If that works, we can make the shadow diameter specific to particular animations rather than the whole ThangType.

It sounds like the action being set to "die" is working? Or do I misunderstand?

@kgy01
Copy link
Contributor

kgy01 commented Mar 22, 2014

You understood everything right. "die" is already working if you add action.Acts to the Arrow object.
(like on my level: http://codecombat.com/editor/level/kgymap)

@nwinter
Copy link
Contributor Author

nwinter commented Mar 22, 2014

By Jove, you're right! So the only step left to do is to add action.Acts to existing levels' Arrows and Spears and to stop drawing the shadow Mark when they are dead and their ThangType name is 'Arrow' or 'Spear'. Do you want to try editing CocoSprite to turn that shadow off?

@nwinter
Copy link
Contributor Author

nwinter commented Mar 23, 2014

I've modified the arrow slightly so that instead of needing to use diesOnHit (which prevents them from bouncing), they just always die when they hit the ground (instead of hitting a target or an obstacle). I am adding Acts to all the arrows and spears, and it'll be in there by default for new instances in the level editor.

So now we just need to be able to disable the shadow appropriately.

@kgy01
Copy link
Contributor

kgy01 commented Mar 25, 2014

I've made it.
The shadow disappears when the arrow hits the ground.
I'll make a pull request.
#687

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