Overdrive Bonus
Posted: Wed Feb 09, 2022 10:08 pm
Hi, I'm trying to make an overdrive bonus, that doubles the value of the points after the user clicks on an object for 20 times, i thought this script works well but sometimes, i see errors and i can't figure out why (for example the thumbPosition does not restart after 20 clicks ecc... one of the bugs i think happens when the user clicks on the "minus" object i will write here its script) another thing i did, is an overdrive minus, that when the user clicks on a "minus" object it takes back the overdrive bonus one number back.
this is the script:
overdrive bonus (when the user clicks on the target object)
overdrive minus (when the user clicks on a "minus" object)
the script of the target object: (the other handlers, i don't think they're relevant)
the "minus" object script:
(if you think there's an easier way to make all this happen the right way please, do tell)
any help would be helpful!
Thanks!
this is the script:
overdrive bonus (when the user clicks on the target object)
Code: Select all
on UpdateOverDriveClickBonus
add 1 to _sessionClicks
add 1 to _sessionClicks2
set the thumbPosition of scrollbar "ProgressOverDrive" to (_sessionClicks2 - _alreadyDid)
put CalculateOverDriveBonus() into _overDriveBonus
put CalculateOverDriveBonus2() into _overDriveBonus2
if _overDriveBonus2 is an integer
then
put "X" & _overDriveBonus2 into field "overDriveBonus"
ShowBetterOverDrive
else
end if
end UpdateOverDriveClickBonus
function CalculateOverDriveBonus2
return (_sessionClicks / 20 ) +1
end CalculateOverDriveBonus2
function CalculateOverDriveBonus
return trunc (_sessionClicks / 20 ) +1
end CalculateOverDriveBonus
on ShowBetterOverDrive
if _overDriveBonus > 1
then
--resetta lo scrollbar a 0
set the thumbPosition of scrollbar "ProgressOverDrive" to 0
--resetta il numero dei click
#put empty into _sessionClicks2
--aggiungi 20 nel variable dei già fatt
add 20 to _alreadyDid
--set the size of fld "overDriveBonus" to più grande
set the textSize of fld "overDriveBonus" to 115
set the width of fld "overDriveBonus" to 150
set the height of fld "overDriveBonus" to 130
set the loc of fld "overDriveBonus" to 160,80
send RepositionOverDrive to me in 1.5 seconds
else
end if
end ShowBetterOverDrive
on RepositionOverDrive
--resize
set the textSize of fld "overDriveBonus" to 30
set the width of fld "overDriveBonus" to 46
set the height of fld "overDriveBonus" to 31
--relocate
set the location of fld "overDriveBonus" to 285,18
end RepositionOverDrive
Code: Select all
on OverDriveMinus
if _overDriveBonus2 > 1
then
--quelli che si vedranno
put empty into _sessionClicks2
put empty into _alreadyDid
--
put the thumbPosition of scrollbar "ProgressOverDrive" into tInPiu
put (_sessionClicks - 20 - tInPiu) into _sessionClicks
put (_overDriveBonus2 - 1) into _overDriveBonus2
#if _alreadyDid > 20
#then
#put (_alreadyDid - 20) into _alreadyDid
#set the thumbPosition of scrollbar "ProgressOverDrive" to 0
else
end if
if _overDriveBonus > 1
then
put (_overDriveBonus - 1) into _overDriveBonus
put "X" & _overDriveBonus into field "overDriveBonus"
else
end if
set the thumbPosition of scrollbar "ProgressOverDrive" to 0
end OverDriveMinus
Code: Select all
local sLocationOf
on mouseDown
ClickMe
aeMoveDone
displayPlus
end mouseDown
on aeMoveDone
get the location of me
put it into sLocationOf
end aeMoveDone
on ClickMe
dispatch UpdateScore with 5
UpdateOverDriveClickBonus
HandleBonusObject
end ClickMe
on displayPlus
show fld "PlusOneHeader"
set the location of fld "PlusOneHeader" to sLocationOf
send "HideHeader" to me in 0.25 seconds
end displayPlus
on HideHeader
hide fld "PlusOneHeader"
end HideHeader
Code: Select all
local sLocationOf
on mouseDown
ClickMinus100
aeMoveDone
displayMinus
mobileVibrate
end mouseDown
on aeMoveDone
get the location of me
put it into sLocationOf
end aeMoveDone
on ClickMinus100
dispatch UpdateScoreMinuses with -5
OverDriveMinus
end ClickMinus100
on displayMinus
show fld "minusHeader"
set the location of fld "minusHeader" to sLocationOf
send "HideHeader" to me in 0.2 seconds
end displayMinus
on HideHeader
hide fld "minusHeader"
end HideHeader
any help would be helpful!
Thanks!