Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Sword Attack
Started by juen.philipp Nov 19 2016 07:02 AM

3 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

juen.philipp

[GLOBAL: userInfoPane.html]
juen.philipp
  • Observer

  • 5 posts
  • Corona SDK

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

 

 

 

 

                 



[TOPIC: post.html]
#2

retrofitProductions

[GLOBAL: userInfoPane.html]
retrofitProductions
  • Contributor

  • 321 posts
  • Corona SDK

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



[TOPIC: post.html]
#3

juen.philipp

[GLOBAL: userInfoPane.html]
juen.philipp
  • Observer

  • 5 posts
  • Corona SDK

so thank u very much for ur help

 

solved the problem with sword attack :)

 

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



[TOPIC: post.html]
#4

retrofitProductions

[GLOBAL: userInfoPane.html]
retrofitProductions
  • Contributor

  • 321 posts
  • Corona SDK

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.




[topic_controls]
[/topic_controls]