(SOLVED) Tweening for Player 2 doesn't work, despite Player 1 working

Hello there! I’m really close to finishing my classic 2D fighting game, but there’s just one issue that’s been bugging me. See, I’m implementing an ultimate attack system, which is supposed to stop the players from moving, to darken the screen, and essentially play as a cutscene. I’ve written the code for player 1, and it works almost flawlessly, but I’m having issues with Player 2. That is to say that I’m using the same code, but tweaking the variables to suit Player 2.

Through some playtesting, I’ve noticed that the Tween I’m using might be at fault:

This is the P2 code, that seems to bug out the moment the screen darkens.

This is the P1 code, the one that works really well, and the one I’m trying to replicate for P2.

IntendedEffect

This is what’s happening for Player 1, which I want to replicate for Player 2. Everything up until the darkening of the screen works, but the rest, from when the sparkle in the eye appears? Nothing.

Am I really missing something? Am I really dense enough to not see something when copying the same code and just changing a few values?

myabe try putting the timescale and tween action above the hide player 1 and 2 in the P2 special attack events and then tell me if it works

1 Like

Nope. Still the same abrupt darkening. Thanks for the reply tho.

Also, anyone please tell me if they’d like me to show more code. Maybe with a clearer picture this issue’ll be easier to solve.

sure that could help alot can you also show a recording of p2 attack?

1 Like

Not sure what’s causing the issue, it can be some other event messing with it.
But since these events run in sequence, you can try merging them into a single event.

Conditions:

  • h key is pressed
  • animation of character =/ “EnergyBall”
  • boolean variable is false

Actions:

  • change boolean variable to true
  • put objects on layers
  • hide objects
  • set time scale of base layer to 0
  • tween the SpecialColorTweenable to black over 0.3 seconds
  • wait 0.3 seconds
  • create sparkle
  • change sparkle animation
  • etc

So instead of checking if tween finished playing, you can add “wait” with the same duration of the tween.

1 Like

Wow.
First of all, I’d like to thank you both for responding after quite a few days. I was sure that this post had been dead and buried, so I’m really grateful.

First of all, as Phoenix asked, here’s what happens with P2:
P2Effect

It does the first condition/action I ask perfectly, and then it just stops on the black screen.

As for Insein’s suggestion, that’s super clever! I might use that for P1 as well, real concise code! But I tried it on P2, and well…:
ForInsein
It cuts off after the animation is ended, when the event does. So…this leads me to believe that the issue must lie either in the event itself…or something else stopping it from triggering. I might just start looking over the old code, see if some variable somewhere is stopping this from working.

Thanks for the help so far, and if you come up with anything else, I’d love to hear some more input. I’ll update this post once I have time to come up with a suggestion.

I don’t see anything wrong with the event and this makes me believe that the issue lies somewhere else.

Try disabling other events until the issue goes away, this way you can isolate the problem and figure out which event is causing it.

1 Like

Yes. At the moment my plan is to disable the P1 events. See if only one sequence is allowed to run, and go from there. If P2 works, then the issue must be when they’re both coded.

I’ll keep you in the loop!

IT’S SOLVED!

The issue was, yes, because of another line of code entirely. I was just too stupid to notice.

For starters, I’ve coded most of P1 and P2’s actions to stay under a reversed “If Time Scale of layer Base Layer = 0”, so that the players wouldn’t be able to control characters during round countdowns or at the end of a round. So that would mean that code I put under it would only work if the time layer is bigger than 1. And so I took a look at the P2 code:


Y’all see the problem, right?
There’s no way the Special for P2 could’ve worked if it’s influenced by that. No wonder the other code didn’t work, THE TWEENING EVENT LITERALLY FORBID IT FROM SO.

…and then I took a look at Player 1’s code:

Completely independent of that large time scale condition. And the result? IT ACTUALLY WORKS!
So yeah…I took the P2 code out of that dependant condition, and whaddya know? It actually works now. Wonders, I’d say.

P.S: I’ve implemented Insein’s advice. Now the code’s more concise. Thanks a lot! Thank you everyone!

2 Likes