Solarus-Games English Forum

Solarus => Development => Topic started by: ponderitus on February 11, 2019, 09:10:11 AM

Title: combos...again
Post by: ponderitus on February 11, 2019, 09:10:11 AM
I've been thinking about combo's again like many other before and i was wondering whether its possible to have one item call another within a timer to kind of...pretend its a combo

eg... 'item A' on use
       create timer, if 'item A' used again within timer then
        use 'item B'

would this be possible?
is this a stupid way to do it?
is there a better way?
Title: Re: combos...again
Post by: llamazing on February 11, 2019, 02:00:41 PM
Yes, this is very possible.

It's difficult to provide help without knowing more details about what you are trying to accomplish, though.
Title: Re: combos...again
Post by: ponderitus on February 11, 2019, 03:37:26 PM
I was thinking about making a punch then kick just so that punch isnt constantly being spammed, i was trying to make Dbz characters and even though it looks pretty cool them spamming punching, it just got me thinking, this is where i got to with them...

https://www.youtube.com/watch?v=wREFt_7-HqE&feature=youtu.be (https://www.youtube.com/watch?v=wREFt_7-HqE&feature=youtu.be)
Title: Re: combos...again
Post by: alexgleason on February 11, 2019, 08:53:22 PM
I'd probably create an "attack queue" on the hero.

It's a history of recent attacks, stored as a Lua table.

When you press "attack":
1. The game reviews the current attack queue,
2. determines what the attack action will be based on that queue,
3. then performs the attack action
4. and pushes it on the queue.

You could add a cooldown timer to the hero, like `hero.cooldown = sol.timer.start(hero, 1000, function() hero:reset_attack_queue() end)`

Then whenever you handle an attack, call `hero.cooldown:set_remaining_time(1000)` to reset the cooldown.

You will probably have to tweak this concept to make it really work, but this is the way I'd approach it.
Title: Re: combos...again
Post by: ponderitus on February 12, 2019, 10:09:34 AM
ok cool that sounds like a good way to go about it, waaaaaaaaay to advanced for what i can do at the moment though so ill look into it later when I'm hopefully more adept