Author Topic: combos...again  (Read 1831 times)

ponderitus

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
combos...again
« 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?

llamazing

  • Full Member
  • ***
  • Posts: 201
    • View Profile
Re: combos...again
« Reply #1 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.

ponderitus

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: combos...again
« Reply #2 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

alexgleason

  • Full Member
  • ***
  • Posts: 128
  • Vegan on a Desert Island
    • View Profile
    • Vegan on a Desert Island
Re: combos...again
« Reply #3 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.
RIP Aaron Swartz

ponderitus

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: combos...again
« Reply #4 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