TNT Basic Forums > Programming Q&A
Reprint sprites
< Last Thread     Next Thread >
Thread        Post A Reply

03-17-2009 19:12

Posted by:

Paris France

Find more posts by Maxime

I do not succes with that problem.
In my Curling game, I have a window for aiming and launching, (drawn by AffLance ) with its Viewport and canvas, with an image and some stones (sprites drawn by AffPL). I can toggle to a Zoom window. But when I come back to Lance window, the image is redrawn, but not the stones ! This is part of my code :

procedure AffLance() 'Aim and Launch window
int eql,jrl,il
if opened=canZoom
Close ViewPort canZoom
Open Viewport canLance,xwLance,ywLance to xwfLance,ywfLance
end if
canvas canLance
Set Pen Colour Make Colour (200,150,50) : Fill Rect 0,0 to xwfLance-xwLance, 100' end wall
Paste Image 0,50,5 'image of ice and spectators
Sprite 8,xChange, yChange,8 ' Button ChangeVue to toggle
for eql=Hom to Mac 'draws every stone (SHOULD !)
for jrl=8 to 1 step -1
il=10*eql+jrl : CalcP2L(il) : AffPL(il, xPL, yPL)
next jrl
next eql
draw frame
end proc

procedure AffPL(int ip,int xp,int yp) ' Draws stone in Lance, with local coords xPL, yPL.
float p=110/(1050-px[ip]) 'scale
int eql=ip/10 'to get stone color
canvas canLance
Sprite 10000+ip, xp, yp, 9+eql : Set Sprite X Scale 10000+ip,p : Set Sprite Y Scale 10000+ip,p ' aff stone redimed
end proc

proc CalcP2L : just a small 3D calculation of xy in Lance window

To make clear : On the first launch, this works perfectly. When I toggle to Zoom window (same place, another Viewport and canvas), and from there back to Lance window, I have the image, the button, but no more stones.
The xy are correct for it works on the first time (and I have printed them to be sure)...
Any idea ? Thanks

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.