Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support
reneuend wrote:You can call it from a hotspot, but you can't have it the earthquake efffect occur on the hotspot. It works on the whole frame.
'Define the image you want to load and set the duration of shaking in seconds
'The image file must be located in the External folder
'
'Syntax:
'
'Shake "FILENAME", TIME_TO_SHAKE(S)
'-----------------------------------------------------------------------------
Shake "Library.jpg", 6
If myVar = 1 then
Shake "Mercedes.jpg", 3
end if
mercedes wrote:reneuend wrote:You can call it from a hotspot, but you can't have it the earthquake efffect occur on the hotspot. It works on the whole frame.
Ya that would be fine...If it happens on the whole frame...
However can u call it...when you want though in the hotspot..[Is what i should have asked.]
I want it to only shake...if something happens..[with a condition..]..
sub InitializeHS_Shake (duration)
ycor=hotspot(1).top
xcor=hotspot(1).left
timedevent=0
Text(1)=duration
timedevent=Action.CreateTimedEvent ((0.05), "ShakeHS", True)
Action.CreateTimedEvent duration, "StopShake 0", False
End Sub
sub ShakeHS
Randomize
Hotspot(1).Top = ycor + int(rnd*(5))*15
Hotspot(1).Left = xcor + int(rnd*(5))*15
End Sub
sub StopShake (duration)
Action.RemoveTimedEvent timedevent
Hotspot(1).top=ycor
Hotspot(1).left=xcor
End Sub
InitializeHS_Shake 3
Just call the sub from frame properties, hotspot properties or from your own script with this little code.
InitializeHS_Shake 1, 3
sub InitializeHS_Shake (hs_index,duration)
ycor=hotspot(hs_index).top
xcor=hotspot(hs_index).left
timedevent=0
timedevent=Action.CreateTimedEvent (.05, "ShakeHS(hs_index)", True)
Action.CreateTimedEvent duration, "StopShake hs_index, 0", False
End Sub
sub ShakeHS(hs_index)
Randomize
Hotspot(hs_index).Top = ycor + int(rnd*(5))*15
Hotspot(hs_index).Left = xcor + int(rnd*(5))*15
End Sub
sub StopShake (hs_index, duration)
Action.RemoveTimedEvent timedevent
Hotspot(hs_index).top=ycor
Hotspot(hs_index).left=xcor
End Sub
sub ShakeHS(hs_index)
Randomize
xval = xcor + int(Rnd()*(50))*15
yval = ycor + int(Rnd()*(50))*15
Hotspot(hs_index).Top = xval
Hotspot(hs_index).Left = yval
'xval = xcor + int(Rnd()*50)*15
'yval = ycor + int(Rnd()*50)*15
'Hotspot(hs_index).Move xval,yval
Text(1).Caption = xval & "," & yval
End Sub
sub InitializeHS_Shake (duration,hsnr)
ycor=hotspot(hsnr).top
xcor=hotspot(hsnr).left
shakehsnr=hsnr
timedevent=Action.CreateTimedEvent ((0.05), "ShakeHS", True)
Action.CreateTimedEvent duration, "StopShake", False
End Sub
sub ShakeHS
Randomize
Hotspot(shakehsnr).Top = ycor + int(rnd*(5))*15
Hotspot(shakehsnr).Left = xcor + int(rnd*(5))*15
End Sub
sub StopShake
Action.RemoveTimedEvent timedevent
Hotspot(shakehsnr).top=ycor
Hotspot(shakehsnr).left=xcor
End Sub
InitializeHS_Shake 3,1
juhuwoorps wrote:Here's the project folder. It works for me.
Return to Adventure Maker Technical Support and Bug Reports
Users browsing this forum: No registered users and 0 guests