Post by honkytonk on Mar 16, 2022 14:33:00 GMT
There are: 8 "cat" sprites on top, 8 "nou" sprites on bottom
4 "bar" sprites which are bars on middle
1 "curs" sprite which is a dot.
Moving the bars with the mouse works.
The random movement of "cat" works.
The problem: When I launch the movement of the "cat" (with [go]), and I move a bar, it accelerates the movement of the "cat". And I dont understand why ??
What's going on ?
Thank you for.
4 "bar" sprites which are bars on middle
1 "curs" sprite which is a dot.
Moving the bars with the mouse works.
The random movement of "cat" works.
The problem: When I launch the movement of the "cat" (with [go]), and I move a bar, it accelerates the movement of the "cat". And I dont understand why ??
What's going on ?
Thank you for.
NOMAINWIN
mapw=1000: maph= 500
WindowWidth=mapw+15: WindowHeight=maph+40
UpperLeftX = 10: UpperLeftY = 10
BUTTON #w.go, "Go !", [go], UL, 20, 10, 40, 20
GRAPHICBOX #w.g, 5, 5, mapw, maph
OPEN "Manif" FOR window_nf AS #w
#w, "TRAPCLOSE [closeHelp]"
#w.g, "when leftButtonDown [scanne]"
#w.g, "when leftButtonMove [MoveCmd]"
#w.g, "when rightButtonDown [coord]"
#w.g, "down;fill lightgray;color white;backcolor lightgray"
#w.g, "getbmp fond 5 5 ";" ";mapw;" ";maph
#w.g, "background fond"
dim cat$(10): dim nou$(10): dim bar$(10): dim mapx(1000): dim mapy(500)
bp$="aa.bmp bb.bmp cc.bmp dd.bmp ee.bmp ff.bmp gg.bmp hh.bmp "+_
"ii.bmp jj.bmp kk.bmp ll.bmp mm.bmp nn.bmp oo.bmp pp.bmp "+_
"bar1.bmp bar2.bmp bar3.bmp bar4.bmp"
LOADBMP "curs","bmp\curso.bmp": #w.g, "addsprite curs curs"
for x=1 to 8
cat$(x)=word$(bp$,x): nou$(x)=word$(bp$,x+8)
LOADBMP cat$(x),"bmp\";cat$(x)
LOADBMP nou$(x),"bmp\";nou$(x)
#w.g, "addsprite ";cat$(x);" ";cat$(x)
#w.g, "addsprite ";nou$(x);" ";nou$(x)
next x
for x=1 to 4
bar$(x)=word$(bp$,x+16)
LOADBMP bar$(x),"bmp\";bar$(x)
#w.g, "addsprite ";"lever";str$(x);" ";bar$(x)
next x
for x=1 to 8
#w.g, "spritexy ";cat$(x);" ";"-200";" ";"150" 'expulse sprites
#w.g, "spritexy ";nou$(x);" ";"-200";" ";"150"
#w.g, "drawsprites"
next x
xa=100: ya=250
for a=1 to 4
#w.g, "spritexy ";"lever";str$(a);" ";"-200";" ";"150" 'expulse sprites
#w.g, "spritexy ";"lever";str$(a);" ";xa;" ";ya 'place sprites bars
xa=xa+150
#w.g, "drawsprites": #w.g, "flush"
next a
x=20: y=30
for a=1 to 8
#w.g, "spritexy ";cat$(a);" ";x;" ";y 'place sprites cats
x=x+90
#w.g, "drawsprites": #w.g, "flush"
next a
xx=20: yy=400
for a=1 to 8
#w.g, "spritexy ";nou$(a);" ";xx;" ";yy 'place sprites nou
xx=xx+90
#w.g, "drawsprites": #w.g, "flush"
next a
wait
[go]
for a=1 to 8
scan
ux=int(rnd(1)*2) + 1: uy=int(rnd(1)*2) + 1
#w.g, "spritemovexy ";cat$(a);" ";ux;" ";uy
#w.g, "drawsprites"
if mapx(ux)=1 or mapy(uy)=1 then
#w.g, "spritemovexy ";cat$(a);" ";ux-(ux*2);" ";uy-(uy*2)
#w.g, "drawsprites"
end if
gosub [pause]
next a
wait
[scanne]
#w.g, "spritexy curs ";MouseX;" ";MouseY ' move sprite 'curs' under the mouse to know collides event.
#w.g, "spritecollides curs list$"
currentLever$ = word$(list$,1)
[MoveCmd]
currentY = MouseY: currentX = MouseX
select case val(right$(currentLever$,1))
case 1
#w.g, "spritexy ";currentLever$;" ";currentX;" ";currentY
for h=currentX to currentX+70
mapx(h)=1: mapy(currentY)=1: mapy(currentY+1)=1
next h
case 2
#w.g, "spritexy ";currentLever$;" ";currentX;" ";currentY
for h=currentX to currentX+70
mapx(h)=1: mapy(currentY)=1: mapy(currentY+1)=1
next h
case 3
#w.g, "spritexy ";currentLever$;" ";currentX;" ";currentY
for h=currentX to currentX+70
mapx(h)=1: mapy(currentY)=1: mapy(currentY+1)=1
next h
case 4
#w.g, "spritexy ";currentLever$;" ";currentX;" ";currentY
for h=currentX to currentX+70
mapx(h)=1: mapy(currentY)=1: mapy(currentY+1)=1
next h
end select
#w.g, "drawsprites"
wait
[coord]
mx=MouseX: my=MouseY
#w.g, "color black;backcolor lightgray"
#w.g, "place ";mx;" ";my: #w.g, "\ ";mx;" ";my
wait
[pause]
timer 300, [temps]
wait
[temps]
timer 0
return
[closeHelp]
for x=1 to 8
unLOADBMP cat$(x): unLOADBMP nou$(x)
next x
for x=1 to 4
unLOADBMP bar$(x)
next x
unLOADBMP "curs"
CLOSE #w
END