Animation observation Long introduction but quick question
Posted: Thu Dec 05, 2013 11:58 pm
Introduction: Due to overly complex coding and lack of experience I threw away all the code that is usually scripted in the Stack that involved frame rate and dispatching updates and updating screen (I think you know what I mean here without including the code) and all the code that I had written as it was causing so many problems for me in my inexperience. I therefore went back to the drawing board and looked for the simple methods and came up with this. I isloated each aspect of the animation and in a vacuum scripted individual movements with great success. Sub movement, mine dropping, intersect, and the troublesome explosion scenario works a treat (keeping it small to 3 images just for experimentation purposes). I put it together and it worked perfectly.
What I noticed was that the keysdown function would not work without that stack scripting. So I threw it away and did what you see here. Now, it also seems that the scripting in the UNCOMMENTED part of the dropmines also does not work without the stack scripting (referring to what I said above). The Commented line you see here is how I tested the intersect method. What now happens is that everytime I press the start button, the mine drops one pixel per mouseup click. I understand what is happening, but I do not understand why it is happening.
My question therefore is this: Do only certain types of scripting (animation wise) only work when there is a background loop in place such as is found in the well-known animation stack script involving screen updating and frame rates and dispatching updated screen information etc.
thankyou
chris
What I noticed was that the keysdown function would not work without that stack scripting. So I threw it away and did what you see here. Now, it also seems that the scripting in the UNCOMMENTED part of the dropmines also does not work without the stack scripting (referring to what I said above). The Commented line you see here is how I tested the intersect method. What now happens is that everytime I press the start button, the mine drops one pixel per mouseup click. I understand what is happening, but I do not understand why it is happening.
My question therefore is this: Do only certain types of scripting (animation wise) only work when there is a background loop in place such as is found in the well-known animation stack script involving screen updating and frame rates and dispatching updated screen information etc.
thankyou
chris
Code: Select all
on dropMines
--move btn "mine1" from 176,93 to 176,191 without waiting
set the top of btn "mine1" to the top of btn "mine1" + 1
if the top of btn "mine1" > the bottom of card "sendSurface" then
set the loc of btn "mine1" to 327,0
end if
end dropMines
Code: Select all
on startSequence
send "sub3" to me in 2 seconds
send "sub2" to me in 1200 milliseconds
send "sub1" to me in 600 milliseconds
end startSequence
on sub1
set the icon of button "buttonsubbb" to the id of img "blacksub1.png"
end sub1
on sub2
set the icon of button "buttonsubbb" to the id of img "blacksub2.png"
end sub2
on sub3
set the icon of button "buttonsubbb" to the id of img "blacksub3.png"
end sub3
Code: Select all
on arrowkey pKey
if pKey = "left" then
set the left of button "buttonsubbb" to the left of button "buttonsubbb" -1
end if
if pKey = "right" then
set the right of button "buttonsubbb" to the right of button "buttonsubbb" +1
end if
if pKey = "up" then
move button "buttonsubbb" relative +1,-1
end if
if pKey = "down" then
move button "buttonsubbb" relative +1,+1
end if
end arrowkey