It seems to be something that comes with the Forums packet.out of curiosity, who puts the fire icons on the posts?
- -
Гореща Тема?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
It seems to be something that comes with the Forums packet.out of curiosity, who puts the fire icons on the posts?
Interesting because that belief is really spreading, and it's affecting my math studiesrichmond62 wrote: ↑Mon Jan 17, 2022 1:14 pmBUT; the outdated belief that one has to be a Mathematical genius to program computers is nonsense.
All across Europe there is a drive to get ALL children to do programming.that belief is really spreading, and it's affecting my math studies
Wowrichmond62 wrote: ↑Mon Jan 17, 2022 2:01 pmAll across Europe there is a drive to get ALL children to do programming.that belief is really spreading, and it's affecting my math studies
I have children every summer who have no more Mathematics than I had at the age of 9-10-11 who still manage to
have a computer game finished and working within 24 hours of classes.
When I did PASCAL V programming in my second year at University the only reason I was allowed to do
it was because the Head of the Philosophy department wanted to prove the Head of the Mathematics department wrong:
and he did: I came second out of 100 students.
Hi, first of all thanks, second, I'm trying to modify a little bit the stack so that it does:bobcole wrote: ↑Mon Jan 17, 2022 5:50 amFollowing up on Richmond62's recommendation, I devised an example to calculate the "speed" of dragging an object (a button in this case).
The faster you drag the button from one place to another, the higher the speed in pixels per tick (a proxy for the 'force' exerted).
Admittedly rough but it was a fun exercise that might help.
Bob
DragLineSpeed.livecode.zip
Which stack is that?to modify a little bit the stack
This one, previously posted by bobcolerichmond62 wrote: ↑Sat Mar 12, 2022 4:43 pmWhich stack is that?
Certainly if you could post it here we could play around
with it and try to understand what you need.
Thanks!
Code: Select all
on mouseUp
put item 1 of the loc of img "XXX" into LR
put item 2 of the loc of img "XXX" into UD
move img "XXX" to ((LR + 10), (UD + 10)))
end mouseUp
Thanks! that worked in general, but i realized that it doesn't make sense for what I'm trying to do...richmond62 wrote: ↑Sun Mar 13, 2022 8:11 pm240 + 10 = 250
70 + 10 = 80
It isn't that difficult.
If you want you can reduce that from 5 lines of code to only 3.Code: Select all
on mouseUp put item 1 of the loc of img "XXX" into LR put item 2 of the loc of img "XXX" into UD move img "XXX" to ((LR + 10), (UD + 10))) end mouseUp
Code: Select all
on Calculatem
#put all the single nnumbers of the points into variables to semplify the altogheter
put item 1 of sDragStartPosition into tsX
put item 2 of sDragStartPosition into tsY
put item 1 of sDragEndPosition into teX
put item 2 of sDragEndPosition into teY
#the function of the m (pendence)
put ((tsY - teY) / (tsX-teX)) into m
end Calculatem
function CalculateFunction
return Y - teY = m * (X - teX)
end CalculateFunction
Code: Select all
global startT
global startLR
global startUD
on mouseDown
put the time into startT
put item 1 of the loc of me into startLR
put item 2 of the loc of me into startUD
grab me
end mouseDown
on mouseUp
put item 1 of the loc of me into finLR
put item 2 of the loc of me into finUD
put the time into finT
put (finT - startT) into timeTAKEN
put (1/timeTaken) into mSpeed
Code: Select all
local sDragStartTicks, sDragEndTicks, sDragDurationTicks --script variables
local sDragStartSeconds, sDragEndSeconds, sDragDurationSeconds
local sDragStartPosition, sDragEndPosition
local sLineLength
on mouseDown pButtonNumber
put empty into message box
put the loc of me into sDragStartPosition
set the loc of graphic "oval" to sDragStartPosition
put the ticks into sDragStartTicks
grab me
end mouseDown
on mouseUp pButtonNumber
put the loc of me into sDragEndPosition
put the ticks into sDragEndTicks
put (sDragEndTicks - sDragStartTicks) into sDragDurationTicks
put "sDragDurationTicks: " & sDragDurationTicks & return after message box
put sDragDurationTicks / 60 into sDragDurationSeconds
put "sDragDurationSeconds: " & sDragDurationSeconds & return after message box
put "sDragStartPosition " & sDragStartPosition & return after message box
put "sDragEndPosition " & sDragEndPosition & return after message box
put item 1 of sDragEndPosition - item 1 of sDragStartPosition into tHorizontalPixels
put item 2 of sDragEndPosition - item 2 of sDragStartPosition into tVerticalPixels
--calculate the length of the line and the speed
put "tHorizontalPixels: " & tHorizontalPixels & return after message box
put "tVerticalPixels: " & tVerticalPixels & return after message box
set the numberFormat to "#.#"
#QUESTA è LA DISTANZA!!! (d= sqrt(x-x)^2 + (y-y)^2)
put sqrt(tHorizontalPixels^2 + tVerticalPixels^2) into sLineLength
put "sLineLength: " & sLineLength & " (pixels)" & return after message box
put sLineLength into field "Line Length"
put sLineLength/sDragDurationTicks into tDragSpeed --pixels per tick
put "tDragSpeed: " & tDragSpeed & " (pixels/tick)" & return after message box
put tDragSpeed into field "Speed"
drawLine sDragStartPosition, sDragEndPosition
put the bottomLeft of button "DragMe" into tTryEndPlus
#put item 1 of the loc of btn "DragMe" into tX
#put item 2 of the loc of btn "DragMe" into ty
set the bottomLeft of button "DragMe" to sDragEndPosition
#put ((tX - 0), (tY - 50)) into sDragEndPosition
moveCircle sDragStartPosition, sDragEndPosition, sDragDurationTicks
end mouseUp
command drawLine pStartPoint,pEndPoint
set the points of graphic "Line" to pStartPoint,pEndPoint
end drawLine
command moveCircle pStartPoint,pEndPoint,pDragDurationTicks
move graphic "Oval" to pEndPoint in pDragDurationTicks ticks
end moveCircle
on Calculatem
#put all the single nnumbers of the points into variables to semplify the altogheter
put item 1 of sDragStartPosition into tsX
put item 2 of sDragStartPosition into tsY
put item 1 of sDragEndPosition into teX
put item 2 of sDragEndPosition into teY
#the function of the m (pendence)
put ((tsY - teY) / (tsX-teX)) into m
#Set the X and the Y as a further point according to the m and the teY / tsY
if m > 0 and if teY < tsY
then
put (teX + (sLineLength)) into X
put
end Calculatem
function CalculateFunction
#return Y - teY = m * (X - teX)
return m * X - (m * teX) + teY
#put into Y
end CalculateFunction
Code: Select all
local T1
local T2
local LR1
local UD1
local LR2
local UD2
on mouseDown
put item 1 of the loc of me into LR1
put item 2 of the loc of me into UD1
put the milliseconds into T1
grab me
end mouseDown
on mouseUp
put the milliseconds into T2
put item 1 of the loc of me into LR2
put item 2 of the loc of me into UD2
put LR2 - LR1 into relLR
put UD2 - UD1 into relUD
put T2 - T1 into SEX
put (1 / SEX) into XES
put (XES * 100) into XXES
put (LR2 + (relLR * XXES)) into distLR
put (UD2 + (relUD * XXES)) into distUD
put (100000 * XES) into ballSPEED
set the moveSpeed to ballSPEED
move me to distLR, distUD
end mouseUp