Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by mimik

I'm trying to make a Entity have a melee action against a collision object.
For example player stand next to tree, presses enter to start chopping.
Tree revises dmg etc.

Read this approach here:
http://impactjs.com/forums/help/melee-combat

That worked ok, but i dont want to spand a new Entity just for the swining axe.
Think Harvest Moon actions/rune factory if you will.

How do i do this?
ig.input.pressed('hit') && (this.axe)){
   this.currentAnim = this.anims.chop;

}

check for tree collision
do some chopping!
kill tree.

Any ideas?

1 decade ago by mimik

basically I want a collision check and keypress check on the same time.
so i can then make the "rock" take dmg.

Struggling to make a collision check at the same time as keypress,

Also struggeling with the direction of the collition.
my rock is FIXED the collision detection works. when i bumb player and rock together.

1 decade ago by stahlmanDesign

Your rock must be of type A or B. It cannot be NONE.

1 decade ago by mimik

yeah thanks. as i said i have no problem with the collision detection separably but when with a keycombo

1 decade ago by mimik

the check function only happens when they collide. but i want to stand by an enity and hit it.
can i call ig.input.state inside check function some how?
Need some help with the approach. spawning a invisile new enity works but it i dont think its ideal for this kind of thing.

1 decade ago by paulh

number of routes:

blag raycast: fire an entity in the direction you want and see what it collides with.

Use the distance to entity and see if your stood near anything. use the angle to entity to find out which entity is at the Orientation you want. (because you might have four or more entities within the distance)


make the rock collision box bigger and check if player collides with it (not a good idea).
i think really what your looking for though is an animated tile, check to see if the player is adjacent to the tile and then step through the animation until the rock is destroyed.

1 decade ago by mimik

Thanks Paulh,
I wen't with th the Tile approach, it was really the best approach.

Then i just went with a handleMovementTrace
and saved the tiles properties based on the tile.

Cutting Rocks/Trees now works fine.
:-)
Page 1 of 1
« first « previous next › last »