preliminary AI battle support

This commit is contained in:
Yonokid
2025-12-31 00:29:52 -05:00
parent f384de454f
commit ac7c7abf82
8 changed files with 431 additions and 28 deletions

View File

@@ -107,7 +107,7 @@ class Chara2D:
self.current_anim = self.past_anim
self.anims[self.current_anim].restart()
def draw(self, x: float = 0, y: float = 0, mirror=False):
def draw(self, x: float = 0, y: float = 0, mirror=False, scale=1.0):
"""
Draw the character on the screen.
@@ -117,9 +117,9 @@ class Chara2D:
mirror (bool): Whether to mirror the character horizontally.
"""
if self.is_rainbow and self.current_anim not in {'soul_in', 'balloon_pop', 'balloon_popping'}:
self.tex.draw_texture(self.name, self.current_anim + '_max', frame=self.anims[self.current_anim].attribute, x=x, y=y)
self.tex.draw_texture(self.name, self.current_anim + '_max', frame=self.anims[self.current_anim].attribute, x=x, y=y, scale=scale)
else:
if mirror:
self.tex.draw_texture(self.name, self.current_anim, frame=self.anims[self.current_anim].attribute, x=x, y=y, mirror='horizontal')
self.tex.draw_texture(self.name, self.current_anim, frame=self.anims[self.current_anim].attribute, x=x, y=y, mirror='horizontal', scale=scale)
else:
self.tex.draw_texture(self.name, self.current_anim, frame=self.anims[self.current_anim].attribute, x=x, y=y)
self.tex.draw_texture(self.name, self.current_anim, frame=self.anims[self.current_anim].attribute, x=x, y=y, scale=scale)

View File

@@ -14,6 +14,7 @@ class PlayerNum(IntEnum):
P2 = 2
TWO_PLAYER = 3
DAN = 4
AI = 5
class ScoreMethod():
GEN3 = "gen3"

View File

@@ -58,6 +58,9 @@ class Nameplate:
"""
tex = global_tex
tex.draw_texture('nameplate', 'shadow', x=x, y=y, fade=min(0.5, fade))
if self.player_num == PlayerNum.AI:
tex.draw_texture('nameplate', 'ai', x=x, y=y)
return
if self.player_num == 0:
frame = 2
title_offset = 0

View File

@@ -297,7 +297,7 @@ class TextureWrapper:
else:
ray.DrawTexturePro(tex_object.texture, source_rect, dest_rect, origin, rotation, final_color)
if tex_object.controllable[index] or controllable:
self.control(tex_object)
self.control(tex_object, index)
def draw_texture(self, subset: str, texture: str, color: Color = Color(255, 255, 255, 255), frame: int = 0, scale: float = 1.0, center: bool = False,
mirror: str = '', x: float = 0, y: float = 0, x2: float = 0, y2: float = 0,