conversations
list
source
string
stack
string
[ { "from": "system", "value": "Add extra space in collision demo\n" }, { "from": "human", "value": "CON\n\n _clkmode = xtal1|pll16x\n _xinfreq = 5_000_000\nOBJ\n lcd : \"LameLCD\"\n gfx : \"LameGFX\"\n ctrl : \"LameControl\"\n fn : \"LameFunctions\"\n box : \"gfx_box\"\n boxo : \"gfx_box_o\"\nVAR\n byte x1, y1\n byte x2, y2\n\nCON\n w = 24\n h = 24\nPUB Main\n lcd.Start(gfx.Start)\n x2 := 52\n y2 := 20\n repeat\n gfx.ClearScreen(0)\n ctrl.Update\n if ctrl.Left\n if x1 > 0\n x1--\n if ctrl.Right\n if x1 < gfx#res_x-24\n x1++\n if ctrl.Up\n if y1 > 0\n y1--\n if ctrl.Down\n if y1 < gfx#res_y-24\n y1++\n if fn.TestBoxCollision(x1, y1, w, h, x2, y2, w, h)\n gfx.InvertColor(True)\n gfx.Sprite(boxo.Addr,x1,y1,0)\n gfx.Sprite(boxo.Addr,x2,y2,0)\n gfx.Sprite(box.Addr,x1,y1,0)\n gfx.InvertColor(False)\n lcd.DrawScreen\n" }, { "from": "gpt", "value": "CON\n\n _clkmode = xtal1|pll16x\n _xinfreq = 5_000_000\nOBJ\n lcd : \"LameLCD\"\n gfx : \"LameGFX\"\n ctrl : \"LameControl\"\n fn : \"LameFunctions\"\n box : \"gfx_box\"\n boxo : \"gfx_box_o\"\nVAR\n byte x1, y1\n byte x2, y2\n\nCON\n w = 24\n h = 24\n \nPUB Main\n lcd.Start(gfx.Start)\n x2 := 52\n y2 := 20\n repeat\n gfx.ClearScreen(0)\n ctrl.Update\n if ctrl.Left\n if x1 > 0\n x1--\n if ctrl.Right\n if x1 < gfx#res_x-24\n x1++\n if ctrl.Up\n if y1 > 0\n y1--\n if ctrl.Down\n if y1 < gfx#res_y-24\n y1++\n if fn.TestBoxCollision(x1, y1, w, h, x2, y2, w, h)\n gfx.InvertColor(True)\n gfx.Sprite(boxo.Addr,x1,y1,0)\n gfx.Sprite(boxo.Addr,x2,y2,0)\n gfx.Sprite(box.Addr,x1,y1,0)\n gfx.InvertColor(False)\n lcd.DrawScreen\n" } ]
propeller-spin
chosen