Animation engine per livecode è diventato open source:
https://github.com/derbrill/animationEngine
lunedì 26 novembre 2018
sabato 13 ottobre 2018
Immagini scalate prospettivamente
Oggi vediamo un programma per modificare prospetticamente le immagini:
Lo potete scaricare da qui: http://livecodeshare.runrev.com/stack/893
Vi basterà copiare il gruppo hhPoly nella vostra card ed usare il codice:
Semplice no?
Lo potete scaricare da qui: http://livecodeshare.runrev.com/stack/893
Vi basterà copiare il gruppo hhPoly nella vostra card ed usare il codice:
send ("setTarget " & the short name of image miaImmagine) to group "hhPoly"Semplice no?
martedì 11 settembre 2018
Libreria per Poker
Ecco la mia libreria per il gioco del Poker:
on MouseUp #hand notation like: #1c,2d,3h,4s,13s put field "hand" into tHand put analPoint(thand) into field 2end MouseUp
function analPoint tHand sort items of thand numeric by the char 1 to -2 of each repeat with i=1 to 5 put item i of tHand into th[i] end repeat #we must go in order #https://www.pagat.com/poker/rules/ranking.html ###################### #Straight Flush put true into testsuit repeat with i=2 to 5 if the last char of th[i - 1] is not the last char of th[i] then put false into testsuit end repeat if testsuit then #they have the same suit if checkscale(th) then return "Straight Flush: " & maxcard(th,"Straight Flush") end if end if ############################## #Four of a kind put countDup(th) into duplist repeat for each key tKey in duplist if dupList[tKey] = 4 then return "Four of a kind: " & tKey end repeat ############################### #Full House repeat for each key tKey in duplist if dupList[tKey] = 3 then put tkey into FH3 repeat for each key tKey2 in duplist if dupList[tKey2] = 2 then put tkey2 into FH2 return "Full House: " & FH3 & "." & FH2 end if end repeat end if end repeat ############################################## #Flush if testsuit then sort items of thand descending numeric by the char 1 to -2 of each repeat with i=1 to 5 delete the last char of item i of thand end repeat return "Flush: " & thand end if ##################################################### #Straight if checkscale(th) then return "Straight: " & maxcard(th,"Straight") end if ############################# #Three of a Kind repeat for each key tKey in duplist if dupList[tKey] = 3 then put tkey into FH3 return "Three of a Kind: " & FH3 end if end repeat ############################# #Two Pairs repeat for each key tKey in duplist if dupList[tKey] = 2 then put tkey into P1 put 0 into dupList[tKey] repeat for each key tKey2 in duplist if dupList[tKey2] = 2 then put tkey2 into P2 put P1 & comma & P2 into PT sort items of PT descending numeric return "Two Pairs: " & PT end if end repeat end if end repeat ########################### #Pair repeat for each key tKey in duplist if dupList[tKey] = 2 then return "Two Pairs: " & tKey end if end repeat ############################# #Nothing return "Nothing: " & maxcard(th,"Nothing")end analPoint
function countDup th repeat for each element tele in th add 1 to temp[char 1 to -2 of tele] end repeat return tempend countDup function checkScale th #check if it is a scale if checkace(th) and checkKing(th) then put th into th2 #backup put swapace(th) into th #now aces are 14 in value end if #we need to sort again put sortedArray(th) into th put true into test1 repeat with i=2 to 5 if ((char 1 to -2 of th[i-1]) + 1) is not (char 1 to -2 of th[i]) then put false into test1 end repeat return test1end checkscale
function checkAce th put false into test1 repeat for each element tele in th delete the last char of tele if tele = 1 then put true into test1 end repeat return test1end checkace
function checkKing th put false into test1 repeat for each element tele in th delete the last char of tele if tele = 13 then put true into test1 end repeat return test1end checkKing
function SwapAce th repeat with i=1 to 5 if char 1 to -2 of th[i] = 1 then put 14 into char 1 to -2 of th[i] end repeat return thend SwapAce
function sortedArray @pArray # fetch the keys and sort them using the array entry values get the keys of pArray sort lines of it numeric by char 1 to -2 of pArray[each] split it by return # create a new sorted array using the mapped keys put 1 into tNextIndex repeat for each element tIndex in it put pArray[tIndex] into tSortedArray[tNextIndex] add 1 to tNextIndex end repeat return tSortedArrayend sortedArray
function maxcard th, hType switch htype case "Straight" case "Straight Flush" if checkace(th) and checkKing(th) then return "ACE (14)" else return maxcard2(th) end if break case "Nothing" return maxcard2(th) break end switchend maxcard
function maxcard2 th put 0 into temp repeat for each element tele in th if char 1 to -2 of tele > temp then put char 1 to -2 of tele into temp end repeat return tempend maxcard2lunedì 10 settembre 2018
Nuova versione
Il 4 Settembre è stata rilasciata la versione 9.0.1 RC 3. La potete scaricare da qui: https://downloads.livecode.com/livecode/
Tra le novità abbiamo:
Tra le novità abbiamo:
- androidRequestPermission: permette di chiedere all'utente su Android dei permessi temporaneamente.
- nuove funzione per il volume stereo su Mac
- mobileSetFullScreenRectForOrientations
- correzioni di vari bug
mercoledì 29 agosto 2018
Video come creare un gioco i pochi minuti
Ho appena realizzato un video dove mostro come ealizzare un gioco stile Breakout / Arkanoid in pochi minuti.
Lo potete vedere qui:
Lo potete vedere qui:
mercoledì 22 agosto 2018
Lavorare in gruppo
Come fanno le grandi aziende con grossi team ad usare Livecode?
Questa domanda nasce spontanea quando ci si rende conto che il sorgente livecode è un file binario che contiene tutto, immagini, suoni, codice, ecc.
I sistemi di controllo della versione usuali non gestiscono le differenze di questo tipo di file.
Esistono diverse soluzioni, ma tra le più collaudate c'è Levure, che potete scaricare qui:
https://github.com/trevordevore/levure/wiki
In pratica i programmi creati con Levure/Livecode hanno il codice messo a parte, in file di testo separati, ed è possibile quindi utilizzare qualunque sistema di controllo della versione, come GIT.
Chiaramente ha senso solo se state lavorando in tanti su un enorme progetto.
Questa domanda nasce spontanea quando ci si rende conto che il sorgente livecode è un file binario che contiene tutto, immagini, suoni, codice, ecc.
I sistemi di controllo della versione usuali non gestiscono le differenze di questo tipo di file.
Esistono diverse soluzioni, ma tra le più collaudate c'è Levure, che potete scaricare qui:
https://github.com/trevordevore/levure/wiki
In pratica i programmi creati con Levure/Livecode hanno il codice messo a parte, in file di testo separati, ed è possibile quindi utilizzare qualunque sistema di controllo della versione, come GIT.
Chiaramente ha senso solo se state lavorando in tanti su un enorme progetto.
lunedì 20 agosto 2018
Guida ai widget
Finalmente è stata pubblicata una guida decente ai widget, la potete trovare qui:
https://github.com/livecode/livecode-ide/blob/develop/Documentation/guides/Extending%20LiveCode.md
https://github.com/livecode/livecode-ide/blob/develop/Documentation/guides/Extending%20LiveCode.md
Iscriviti a:
Post (Atom)
