Tremble
BlitzPlus Forums/BlitzPlus Programming/Tremble
| ||
Sorry for my English. anyone can help me to walk my Hero without tremble? thanks. [CODE] Graphics 640,480,0,2 xpos = 100 ypos = 10 hero = CreateImage(20,70) terra = CreateImage(640,480) SeedRnd MilliSecs() ; make terrain yline = 300 For xx = 0 To 31 y=Rand(-30,30) Line xx*20,yline,xx*20+20,yline+y Line xx*20,yline+1,xx*20+20,yline+y+1 Line xx*20,yline+2,xx*20+20,yline+y+2 yline = yline + y Next GrabImage terra,0,0 ; make Hero Oval 50,50,20,20,0 Rect 50,70,20,50,0 GrabImage hero,50,50 Repeat Cls Text 0,0,"SPACE BAR TO CHANGE COLLISION" If swap = 0 mem_ypos = ypos ; <- memorizza coordinata Y ypos = ypos + 2 ; coordinata Y corrente If ImagesCollide(hero,xpos,ypos,0,terra,0,0,0) ypos = mem_ypos EndIf EndIf If swap = 1 If ImagesCollide(hero,xpos,ypos,0,terra,0,0,0) ypos = ypos - 2 Else ypos = ypos + 2 EndIf EndIf If KeyDown(57) If swap = 0 swap = 1 Else swap = 0 EndIf FlushKeys() EndIf If KeyDown(205) Then xpos = xpos + 2 If KeyDown(203) Then xpos = xpos - 2 DrawImage hero,xpos,ypos DrawImage terra,0,0 Flip Until KeyDown(1) End [\CODE] |
| ||
It seems to work fine when swap=1. What is tremble? Also use KeyHit(57) instead of Keydown(57) |
| ||
He means shaking. When the guy moves, he moves in intervals of 2 pixels. I'm sure some 2D guru around here can remedy this. |
| ||
umm... Graphics 640,480,0,2 SetBuffer BackBuffer() <---- add that |
| ||
I'm a 2D guru! |
| ||
Yes Curtastic you are a true guru of 2D Thank you! |