Sword Attack

any ideas howto do a sword attack with LD

should i createa invisible object for the sword range to detect  collision  or is there an easier method to do so

and how can i set an animation only to play until animation is done and then set it back to normal state i tried to set loops in animation editor to 1 and then used playsequence(attack) like in scroller example but its doing the sequence as long as i clikc the button even if its not done

and also  can i somehow set multiple imagesheets for an character object like every animation from the character has an own imagesheet

for example

i got an diffrent image sheet  for

walk

idle

idle2

jump

attack

but i want to create only one asset out of it so i can call it by the assetname like

 local playerProps =
 {
   name=‘player’,
   objType=‘LDImage’,class=’’,
   width=80,
   height=162,
   x=136,
   y=801,
   xScale=0.43956*1,
   yScale=0.529412*1,
   assetName=playerhero.image----(load asset name from a variable)
 }

mylevel:createObject(“Player”,playerProps)

thank u very much for ure help

wfw philipp juen

                 

I think creating the invisible physics object is probably the best approach as unfortunately you can’t specify different physics per frame of animation (without removing and reapplying).

Try setting the animation loop count to 0 so it only plays once without repeat.

If you need to check if the animation has finished,  the ‘isPlaying’ property should be used.

You can’t really have multiple spritesheets per asset, the idea of a spritesheet is to combine multiple animations within one sheet.

In your example I recommend you add all your frames to the single sheet and simply use LDX to setup the animation sequences and give them a name such as walk, idle etc.

LDX supports import from programs like TexturePacker so it is very easy to bundle all your frames and get TP to create a single sheet.

Hope this helps

so thank u very much for ur help

solved the problem with sword attack :slight_smile:

but my problem with the spritesheets is that i cant get all my animations on just one sheet so could i maybe just do diffrent assets and just change them then or isnt that a good idea

You might need to create your player manually, setting the sequencedata to point to multiple spritesheets then add the object directly to your level using ‘addObject’.

For reference;

https://docs.coronalabs.com/daily/api/library/display/newSprite.html#multiple-image-sheets

It may be possible to use some of the exported data from LDX, such as the asset image sheet data rather than having to recreate it.

I think creating the invisible physics object is probably the best approach as unfortunately you can’t specify different physics per frame of animation (without removing and reapplying).

Try setting the animation loop count to 0 so it only plays once without repeat.

If you need to check if the animation has finished,  the ‘isPlaying’ property should be used.

You can’t really have multiple spritesheets per asset, the idea of a spritesheet is to combine multiple animations within one sheet.

In your example I recommend you add all your frames to the single sheet and simply use LDX to setup the animation sequences and give them a name such as walk, idle etc.

LDX supports import from programs like TexturePacker so it is very easy to bundle all your frames and get TP to create a single sheet.

Hope this helps

so thank u very much for ur help

solved the problem with sword attack :slight_smile:

but my problem with the spritesheets is that i cant get all my animations on just one sheet so could i maybe just do diffrent assets and just change them then or isnt that a good idea

You might need to create your player manually, setting the sequencedata to point to multiple spritesheets then add the object directly to your level using ‘addObject’.

For reference;

https://docs.coronalabs.com/daily/api/library/display/newSprite.html#multiple-image-sheets

It may be possible to use some of the exported data from LDX, such as the asset image sheet data rather than having to recreate it.