game built for old version does not run when using new python stubs
I built the current version 1.2.3019-dev Pro (32853aa), which includes the updated python stubs from https://github.com/nesbox/TIC-80/issues/2350. I tried to run o moku e mun in it, and got this error:
>Traceback (most recent call last):
File "main.py", line 2021
reify(120,85,60,136)
File "main.py", line 1454, in reify
things.app
end(Torch(wx,wy-2,solid_at(wx-4,wy+4)))
File "main.py", line 1398, in
solid_at
return flag_at(x,y,0)
File "main.py", line 1395, in flag_at
return tile_has_flag(tx,ty,f)
File "main.py", line 1403, in
tile_has_flag
return fget(mget(tx,ty),f)
TypeError: expected 'int', got 'float'
if I change the offending line like this:
return fget(mget(tx,ty),f
return fget(mget(int(tx),int(ty)),f
then I'm able to get to the title screen. I suspect there will be other 'legacy' carts that are broken by the new stubs, too. is there a way to disable linting when running a cart?
@Roachbones As I was reviewing some python games broken in current TIC versions (#2841), I found yours.
I also see that your itch page doesn't distribute the .tic cart. I got it from the way the old web tic engine loads the cart, link.
Idk if it was intentional to not let people access it, as some devs may not like the way it can quickly give access to the source code. I understand and respect that if that is the case. I also know that the Last in Space game that is in Itch charge for the final version in .tic.
Anyway, the reason I'm also mentioning this is that as retro handhelds are becoming popular, it is nice to play tic80 games on those devices. I'm also building a tic80 rom collection builder that fetches the freely available roms and bundles it, I will realease it today or tomorrow. It fetches all the roms from the tic80com api, but I could also make it so it would fetch from itch, but the way you published made me question if you were willing to distribute the .tic cart too.
Anyway, I was able to get your cart working in the latest version with the following changes, so it would be nice if you could also update it in the itch website.
--- /home/arthur/.local/share/com.nesbox.tic/TIC-80/moku-old.py
+++ /home/arthur/.local/share/com.nesbox.tic/TIC-80/moku.py
@@ -279,9 +279,9 @@
(68 if self.leaping else \
(67 if self.cooldown<20 else 66)),
round(self.x-camera_x),
- round(self.y-camera_y)-1*self.leaping,
+ round(self.y-camera_y)-1*int(self.leaping),
colorkey=0,
- flip=int(self.facing==-1)|(2*self.dead)
+ flip=int(self.facing==-1)|(2*int(self.dead))
)
def can_jump_to(self,x,y):
@@ -857,7 +857,7 @@
self.speech.draw(cx,cy)
spr(
self.s,
- round(self.x-cx),round(self.y-cy)+(time()%1000>500),
+ round(self.x-cx),round(self.y-cy)+int(time()%1000>500),
colorkey=0,w=1,h=1,scale=2
)
def touched(self,pipi):
@@ -1074,7 +1074,7 @@
if self.sprite:
spr(self.sprite,x,y,colorkey=self.colorkey)
else:
- size = ceil(self.size * (self.life/self.life0))
+ size = int(ceil(self.size * (self.life/self.life0)))
rect(x,y,size,size,self.col)
class Ember(Particle):
@@ -1101,7 +1101,7 @@
if random()<0.2:
self.embers.append(
Ember(
- self.x+randint(0,1)+6*(self.flipped),
+ self.x+randint(0,1)+6*int(self.flipped),
self.y+2)
)
for ember in self.embers: ember.tick()
@@ -1195,7 +1195,7 @@
poke4(0x3ff0*2+14, 1)
poke4(0x3ff0*2+15, 15)
spr(
- self.t//11%4+3,
+ int(self.t)//11%4+3,
round(self.x-cx), round(self.y-cy),
colorkey=0,
)
@@ -1386,8 +1386,8 @@
def tile_at(x,y):
#tx = (floor(x/8)%240+240)%240
#ty = (floor(y/8)%136+136)%136
- tx = floor(x/8)
- ty = floor(y/8)
+ tx = int(floor(x/8))
+ ty = int(floor(y/8))
return tx,ty
def flag_at(x,y,f):
@@ -1546,9 +1546,9 @@
if btn(1):
eztrace(int(pipi.y)//8)
if btnp(2):
- pipi.flap_to(-1 * not (pipi.can_verticate and btn(3)))
+ pipi.flap_to(-1 * int(not (pipi.can_verticate and btn(3))))
if btnp(3):
- pipi.flap_to(1 * not (pipi.can_verticate and btn(2)))
+ pipi.flap_to(1 * int(not (pipi.can_verticate and btn(2))))
global things
for t in things[:]:
@@ -1567,15 +1567,15 @@
if isinstance(t, Moon) and not t.secret:
camera_y = max(camera_y, t.y-30)
- column = floor(pipi.x/240)
+ column = int(floor(pipi.x/240))
if not pipi.dead:
camera_x = column*240 + round(shake)
map_x = (column&7)*30
shake *= -0.7
map(
- map_x,floor(camera_y/8),30,18,\
- -round(shake), -round(camera_y-floor(camera_y/8)*8))
+ map_x,int(floor(camera_y/8)),30,18,\
+ -int(round(shake)), -int(round(camera_y-floor(camera_y/8)*8)))
speeches,non_speeches = [],[]
@@ -1608,12 +1608,12 @@
if not SCENIC:
if DEBUG:
rect(0,1,240,6,8)
- print(int(pipi.x),0,1,12,True,1)
- print(int(pipi.y),32,1,12,True,1)
- print(len(things),64,1,4,True,1)
+ print(str(int(pipi.x)),0,1,12,True,1)
+ print(str(int(pipi.y)),32,1,12,True,1)
+ print(str(len(things)),64,1,4,True,1)
else:
#print(str(round((pipi.y - 800)/(-3700-800)*100))+'%',20,2,12)
- #print(frame//60,2,2,12)
+ #print(str(frame//60),2,2,12)
pass
continue_procgen()
@@ -1698,7 +1698,7 @@
apply_pal(s16)
rect(0,0,240,136,0)
y=-10; f=100 if devil else 400
- open = time()//200 % 70 not in [0,2,17,50,51,52,53]
+ open = int(time())//200 % 70 not in [0,2,17,50,51,52,53]
cy=136//2-24//2+y
map(219,106,10,8,80-8*3,cy-8*2)
offset = 4 if devil else 0
@@ -1777,8 +1777,8 @@
t2 = time()
if frame%5==0: since_last_frame = t2-t1
if DEBUG and since_last_frame > 10 and not SCENIC:
- print(since_last_frame,
- 220,128,3+since_last_frame//20)
+ print(str(since_last_frame),
+ 220,128,3+int(since_last_frame)//20)
t1 = t2
#if btnp(0):debugsummonpods()
@@ -1995,7 +1995,7 @@
tile = TILE_SPIKES if spiky else 0
if tile in COLOR_BRICK:
p = max(0,min(1, 4-abs(my- -250)/20 ))
- if (random()<p if tile%2==0 else mget(mx+x-1,my+y) in COLOR_BRICK.values()):
+ if (random()<p if tile%2==0 else mget(mx+x-1,my+y) in set(COLOR_BRICK.values())):
tile = COLOR_BRICK[tile]
mset(mx+x,my+y,tile)
#eztrace(((rx+w-1-x) if flip else rx+x),ry+y,mx+x,my+y)
@lynn and I actually rewrote the whole thing in lua for performance, but we haven't released the new version yet. Once we do, it should work in the latest version of TIC-80.