TinyCircuits / TinyCircuits-Tiny-Game-Engine

MicroPython game engine for TinyCircuits Thumby Color
GNU General Public License v3.0
9 stars 1 forks source link

Tween animation edges have a habit of flickering #1

Open TinyCircuits opened 4 months ago

TinyCircuits commented 4 months ago

grass_tile_32bit May be specific to PING_PONG animation and final value. Ex. code:

import engine_main

import random

import engine
import engine_input
import engine_physics
import engine_draw
from engine_nodes import Rectangle2DNode, CameraNode, Sprite2DNode, PhysicsRectangle2DNode, EmptyNode, Text2DNode
from engine_resources import TextureResource, FontResource
from engine_math import Vector2
from engine_animation import Tween, Delay, ONE_SHOT, LOOP, PING_PONG, EASE_ELAST_OUT, EASE_ELAST_IN_OUT
import os

print(os.getcwd())

grass = TextureResource("/Games/testgame/grass_tile_16bit.bmp")

engine_physics.set_gravity(0, -0.0)

engine.set_fps_limit(60)

class Tile(PhysicsRectangle2DNode):
    def __init__(self):
        super().__init__(self)
        self.tile = Sprite2DNode(texture=grass, frame_count_x=1)
        self.width = 16
        self.height = 16
        self.tween = Tween()
        self.tile.position.x = 0
        self.tween.start(self.tile, "position", self.tile.position, Vector2(50, 0), 2000.0, 1.0, PING_PONG, EASE_ELAST_IN_OUT)

        self.add_child(self.tile)

    def collision(self, contact):
        self.tween.stop()
        pass

t1 = Tile()
cam = CameraNode()

while True:
    # Only execute code as fast as the engine ticks (due to FPS limit)
    if engine.tick():
        if engine_input.check_pressed(engine_input.A):
            pass