ImpactJS++ Loose Weapon Entity

Need help with an engine or coding not on the list? Need help with a game or the website and forums here? Direct all questions here.
Post Reply
User avatar
zandzpider
Posts: 7
Joined: Mon Feb 24, 2014 8:35 am

ImpactJS++ Loose Weapon Entity

Post by zandzpider »

Hey!

I've just started working with ImpactJS++ and i wanted to create a weapon sprite (let's say an Axe or a Sword)
that moved together with the character and swings the direction the character hits.

I've tried to extend some of the attack/abilities that comes with ImpactJS++ but i cannot get the sprite/entity to move with my character and i have no idea if it actually does damage the way i want.

(Ever played Starbound or Terraria? i want something like that)

feel free to post code or just hints ;-)
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: ImpactJS++ Loose Weapon Entity

Post by hallsofvallhalla »

I have not used Impactjs++ but I have done a paper doll system and basically I just have the weapon entity pos.x and pos.y match the player entity po.x and pos.y

something like this in the weapon entity's update

Code: Select all

 var player = ig.game.getEntitiesByType( EntityPlayer )[0];
this.pos.x = player.pos.x + this.offset;
this.pos.y = player.pos.y + this.offset;

where offset = the exact placement on the character.
User avatar
zandzpider
Posts: 7
Joined: Mon Feb 24, 2014 8:35 am

Re: ImpactJS++ Loose Weapon Entity

Post by zandzpider »

impact++ is rather confusing and i seem to be hacking around alot with alot of guesswork and luck :s urk.

might aswell go ahead and try my shot at some basic impactjs untill i get my shit together
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: ImpactJS++ Loose Weapon Entity

Post by Jackolantern »

zandzpider wrote:impact++ is rather confusing and i seem to be hacking around alot with alot of guesswork and luck :s urk.

might aswell go ahead and try my shot at some basic impactjs untill i get my stinky bottom putty together
Maybe I jumped the gun a bit by saying to learn Impact++ right in with basic Impact. I just said that because I learned ImpactJS before I++ existed, and when I tried to sit down and learn I++, it was difficult because I already knew the "Impact way", and I wished I had learned I++ from the beginning. But maybe that isn't the best strategy. Try learning Impact first, and then when comfortable check out I++, because what I++ offers is very worth the learning curve. It really gives it world-class engine features that should have been added to the core in the first place.
The indelible lord of tl;dr
Post Reply

Return to “Advanced Help and Support”