diff --git a/sonic-radiance.love/scenes/battlesystem/controller/menu.lua b/sonic-radiance.love/scenes/battlesystem/controller/menu.lua index b523a1b..7b9262a 100644 --- a/sonic-radiance.love/scenes/battlesystem/controller/menu.lua +++ b/sonic-radiance.love/scenes/battlesystem/controller/menu.lua @@ -193,12 +193,28 @@ function CharacterMenu:new(scene, name, x, y) self.scene = scene local w, h = MENU_WIDTH, MENU_ITEM_NUMBER * MENU_ITEM_HEIGHT CharacterMenu.super.new(self, scene.menusystem, name, x, y, w, h, MENU_ITEM_NUMBER) + self.cursorTexture = love.graphics.newImage("assets/gui/cursor-menulist.png") + self.cursorTransition = 1 +end + +function CharacterMenu:update(dt) + CharacterMenu.super.update(self, dt) + + local relativecursor = self.widget.selected - self.view.firstSlot + + local transition = self.cursorTransition - relativecursor + + if math.abs(transition) < 0.1 then + self.cursorTransition = relativecursor + else + self.cursorTransition = (self.cursorTransition) + ((relativecursor) - (self.cursorTransition)) * dt*45 + end + end function CharacterMenu:drawCursor() - CharacterMenu.super.drawCursor(self) - --local addition = 16 - --love.graphics.draw(self.cursorTexture, self.x - 12, self.y + (self.cursorTransition) * addition + 2 ) + local addition = 17 + love.graphics.draw(self.cursorTexture, self.x + 4, self.y + (self.cursorTransition) * addition ) end -- WIDGETS