So I want to make a 2 player sports game and I finished creating the code for player 1. I had no issues but when I implemented the code for the second player, I started to get bugs. The animations for the players change depending on the movement of one of the players and the animations are moving way faster for some reason. I checked my code and it seemed to be just fine.
Here is my project
I have a glitch in my game
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
I have a glitch in my game
- Attachments
-
- Game.love
- (200.31 KiB) Downloaded 62 times
Re: I have a glitch in my game
The variable currentAnim is a global variable that is shared by player.lua and polly.lua. Do not use globals for animations, but class fields instead:
Code: Select all
function Polly:animations() -- loads in animations
local g = self.grid
self.idle = anim8.newAnimation(g(("1-4"), 1), 0.1)
self.runAnim = anim8.newAnimation(g(("6-9"), 1), 0.1)
self.jumpAnim = anim8.newAnimation(g((11), 1), 0.1)
self.fallAnim = anim8.newAnimation(g((10), 1), 0.1)
self.currentAnim = self.idle
end
Re: I have a glitch in my game
Thanks! I didn't think that was the issue. It works perfectly now
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 5 guests