Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Mon May 20, 2019 9:22 pm Post subject: Basic Animation Uisng CE GUI and Lua Script |
|
|
Hi, there.
Wanna make an animation for your hack trainer or for others purpose?.
Here a simple code on a primitive way, to make an animation using CE GUI and Lua scripting.
Have to do before you start.
1. Have a GIF picture
2. Split the GIF picture into several PNG pictures format. (Use online for the best and auto result, just google it)
3. Prepare for a background image.
4. Prepare an XM/WAV sound effect/music. (Considering file size)
Example Code:
Code: | f = createForm()
f.setSize(500,250)
f.Position = 'poScreenCenter'
f.Caption = 'CRDR - Basic Animation Concept'
pnl = createPanel(f)
pnl.setSize(500,175)
pnl.setPosition(0,0)
bgrImg = createImage(pnl)
bgrImg.setSize(500,175)
bgrImg.setPosition(0,0)
bgrImg.Align = 'alClient'
bgrImg.Picture.loadFromStream(findTableFile('bgr.jpg').Stream)
bgrImg.Stretch = true
sonic = createImage(pnl)
sonic.setSize(200,200)
sonic.stretch = true
sonic.setPosition(-100,-13)
rat = createImage(pnl)
rat.setSize(100,100)
rat.stretch = true
rat.setPosition(5,50)
btn = createToggleBox(f)
btn.setSize(100,50)
btn.setPosition(10,185)
btn.caption = 'Start'
label1 = createLabel(f)
label1.Left = 127
label1.Top = 190
label1.Caption = '< Increase Speed'
label2 = createLabel(f)
label2.Left = 387
label2.Top = 190
label2.Caption = 'Decrease Speed >'
trb = createTrackBar(f)
trb.setSize(370,50)
trb.Top = 210
trb.Left = 120
trb.Max = 500
trb.Min = 0
trb.Position = 100
trb.SelStart = 0
trb.ScalePos = 'trTop'
---------------------------------------------------------SONIC
function hack1()
sndfile=findTableFile('CHICK.XM')
if (checkbox_getState(btn) == 1) then
if xmplayer_isPlaying() == true then
xmplayer_resume()
else
xmplayer_playXM(sndfile)
end
t.enabled = true
t2.enabled = true
btn.caption = 'Stop'
else
xmplayer_pause()
t.enabled = false
t2.enabled = false
btn.caption = 'Start'
end
end
t = {}
t[1] = 'frame_000.png'
t[2] = 'frame_001.png'
t[3] = 'frame_002.png'
t[4] = 'frame_003.png'
t[5] = 'frame_004.png'
t[6] = 'frame_005.png'
t[7] = 'frame_006.png'
t[8] = 'frame_007.png'
t[9] = 'frame_008.png'
t[10] = 'frame_009.png'
t[11] = 'frame_010.png'
t[12] = 'frame_011.png'
t[13] = 'frame_012.png'
t[14] = 'frame_013.png'
t[15] = 'frame_014.png'
t[16] = 'frame_015.png'
t[17] = 'frame_016.png'
t[18] = 'frame_017.png'
t[19] = 'frame_018.png'
t[20] = 'frame_019.png'
pics={}
for i=1,20 do --- 4 is the total number of your pictures
pics[i]=createPicture()
pics[i].loadFromStream(findTableFile(t[i]).Stream)
end
pics.currentPicture=1
function t_tick()
x,y = sonic.getPosition()
x = x + 5 ------ delete this line if not want change position
sonic.Picture=pics[pics.currentPicture]
pics.currentPicture=(pics.currentPicture % 20)+1 -- carefull here
if x >= f.width then
sonic.setPosition(-100,-13)
x,y = sonic.getPosition()
x = x + 5
else
sonic.setPosition(x,y)
end
end
t = createTimer()
t.interval = 200
t.enabled = false
t.onTimer = t_tick
-------------------------------------------------------------RAT
t2 = {}
t2[1] = 'frame_01.png'
t2[2] = 'frame_02.png'
t2[3] = 'frame_03.png'
t2[4] = 'frame_04.png'
pics2={}
for i2=1,4 do
pics2[i2]=createPicture()
pics2[i2].loadFromStream(findTableFile(t2[i2]).Stream)
end
pics2.currentPicture=1
function t_tick2()
x2,y2 = rat.getPosition()
x2 = x2 + 5 ------ delete this line if not want change position
rat.Picture=pics2[pics2.currentPicture]
pics2.currentPicture=(pics2.currentPicture % 4)+1 -- carefull here
if x2 >= f.width then
rat.setPosition(5,50)
x2,y2 = rat.getPosition()
x2 = x2 + 5
else
rat.setPosition(x2,y2)
end
end
t2 = createTimer()
t2.interval = 100
t2.enabled = false
t2.onTimer = t_tick2
--============================================---
function trbChange(sender)
r = trb.position
t.interval = r
t2.interval = r
end
function exit()
xmplayer_stop()
closeCE()
return caFree
end
f.show()
btn.onChange = hack1
trb.onChange = trbChange
f.onClose = exit
|
CT Source file download (Copy paste URL link below to your web browser):
https://mega.nz/#!3kkVAIYZ!oEPq3Hk2EXoq7fMIHBxKASLO21f6ejkcbhpk-d4iIQY
Demo video:
https://youtu.be/PRzhMifb-Yo
Have funs...
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|