Posted: Tue Jul 02, 2019 9:57 pm Post subject: CRDR - Object Bouncing Logic in Cheat Engine Lua
Hi there,
Do you know the old arcade game called Arkanoid or Wall Break Out ?.
On those games, they using bounce logic to bouncing an object inside a client area.
So, here is the logic used for bouncing an object written in Cheat Engine Lua script.
Note:
1. Click on label object to start bouncing
2. Double click on the form to stop bouncing
3, Try to resize the form to get a bouncing effect (conclusion: object bouncing follows to form size)
local objWidth
local objHeight=50
local objX,objY,volX,volY
function bounced()
volX=math.random(1,4)
volY=math.random(1,4)
objX=lbbounce.Left
objY=lbbounce.Top
objWidth=lbbounce.Width
objX=math.random(0,frm.Width-objWidth)
objX=math.random(0,frm.Height-objHeight)
frm.DoubleBuffer=true
timer1.Enabled=true
end
function timer1_Tick(sender)
lbbounce.Left=objX
lbbounce.Top=objY
objX=objX+volX
if (objX<0) then
volX=-volX
lbbounce.Font.Color=math.random(255,255)
elseif (objX+objWidth>frm.Width) then
volX=-volX
lbbounce.Font.Color=math.random(0,255)
end
objY=objY+volY
if (objY<0) then
volY=-volY
lbbounce.Font.Color=math.random(0,255)
elseif (objY+objHeight>frm.Height) then
volY=-volY
lbbounce.Font.Color=math.random(0,255)
end
end
function stopit()
timer1.Enabled=false
lbbounce.Left=math.floor(frm.Width - lbbounce.Width)/2
lbbounce.Top=math.floor(frm.Height - lbbounce.Height)/2
end
function exiter()
timer1.Enabled=false
timer1.Destroy()
closeCE()
return caFree
end
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum