Help with Erasing while dragging objects
Author |
Message |
Sceyef
|
Posted: Fri Dec 12, 2014 7:24 pm Post subject: Help with Erasing while dragging objects |
|
|
so like, I have never liked animating in turing.
Here's my code. It's a simple drag-an-object program. Primitive, as the object centers on your cursor and stuff, but it works.
code: |
var x, y, button, a, b : int
a := 100
b := 100
var buttonpress : boolean := false
setscreen ("offscreenonly")
loop
mousewhere (x, y, button)
locate (1, 1)
if x > a - 50 and x < a + 50 and y > b - 50 and y < b + 50 then
if button = 1 then
buttonpress := true
else
buttonpress := false
end if
end if
if buttonpress = true then
a := x
b := y
end if
cls
drawfillbox (a - 50, b - 50, a + 50, b + 50, red)
View.Update
end loop
|
Now here's what I need: I am currently erasing the red square with CLS. Later I need to add a background. How can I do that? Try it yourself, but when I attempt to put the usual identical object with colorbg, there are.. problems..? Even If I make the object bigger. It doesn't erase properly. :/
halp |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Zren
|
Posted: Fri Dec 12, 2014 7:33 pm Post subject: RE:Help with Erasing while dragging objects |
|
|
Draw things that appear underneath first, then draw the thing on top second.
|
|
|
|
|
|
|
|