From 530c39f4dee710bb4dea9dbc1e506d59b11c587c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davy=20H=C3=A9lard?= Date: Wed, 28 Dec 2022 01:37:54 +0100 Subject: [PATCH 01/11] Simple R-Tree action. --- .../rtree/assets/Big Brown Meteor (1).png | Bin 0 -> 1804 bytes examples/rtree/assets/Big Grey Meteor (2).png | Bin 0 -> 2310 bytes examples/rtree/assets/Red playerShip (1).png | Bin 0 -> 2710 bytes examples/rtree/game.json | 1297 +++++++++++++++++ 4 files changed, 1297 insertions(+) create mode 100644 examples/rtree/assets/Big Brown Meteor (1).png create mode 100644 examples/rtree/assets/Big Grey Meteor (2).png create mode 100644 examples/rtree/assets/Red playerShip (1).png create mode 100644 examples/rtree/game.json diff --git a/examples/rtree/assets/Big Brown Meteor (1).png b/examples/rtree/assets/Big Brown Meteor (1).png new file mode 100644 index 0000000000000000000000000000000000000000..31e06a4895c2f2b958aa13b664b40a385b3507a4 GIT binary patch literal 1804 zcmV+n2lM!eP)NklvK!i*1I3Wr#ad3z%J5dOPKnMhbgpi_01PKrz5J7-IJb4LT z0!v^CUII%P{0%&$FD)s2wpUM`*%^->_SLw) zrIJ27Ys2Nj2>n$$kyu01}A%G{q*Fk zn-_X(pI$jL^O&s{pL#lPbd5)Qoakp)S9>iAcKhP#ydIv7w-= zD2xpWUBzH*Na!j8V}h<*7oHoGAX#Hf(8b9OQIsq(Cg{SIhbl@|7%LrJ-`=`7`R?8I zsr~TY>yw}EY|PB{w^-z4fw2}Tl$=7eYUDxMZ<8&C?9KG(=Q*sF%^q{wSJfLECyqt=yKtE zYQrP5$5<%3m>)_J1Ou(vV=NS1EI&&U1p|p$V=NS18k2Ae<7UbdV}h=m=b!an^0r-R z<%luYrFkb96Lj6X{E~MRU7{f7k~}+%3A!HaobwXp$M-K4EeggpWP>pcbaAJZE(%r` zw04fMP;_B^5G1SBSSY#(!a^c;Gc8j!QX;v}E$SH4K$mZ7g#phEi$0>LV@v~GzNwX_ zY;B4Rfv+g47z;(0@4&TTw{~(fwkRqX(?FL`YNbuEMoub4Fd8C?3dS_h<&#=zQ~gVo zM++4NyL;&ce~g8q%O|zM{F8GDKtmKT27R0{Cg_5JAq@&KO0m@?Hr^=n7k`t2SB&Md zhA7zm?KO9d3A%7K-vcu^E*C6=J8#iY#o@g9$MyI=qA<5{9G?<0(}EMm1YJx_U8Gi; z3QAnK4TbaOpV*?{)uuPPmXMt=rhzU7*mW+kp{sh~F2Q9iQSi*VegM}_nARB6K$mZ7 zg@I-;rRyc6h8{x{ymj8E8YUvLeZ5X+Rm|`tZ9i~H7mlj z(52a_ShBfv!I<6q|HGFCx=QX^(X=+TAk%1YJo1t~b##^9wUWY1YA1O?7Z&0rF=B(h zd&%)*dZT^osw?!F_`YQNiIPBTs0>*k@&)Ff0u4C=z(&%t{SBU7ul*l#10$q^Ko3NQ6f7^MXnS zoI8s7hKs0{aZ8PHT)jk6DvWunYGX`ca_r+u=_Rc?S#Tv0CZyLZbtV8D%H{~t-69<> z(ion~OQabOFFCvX#AEHcSPWsh+FVV`OBf*68o9a4g@^}U+luGvB}Pict!=eyVKlr1 z?{Fp}D4R*}LV{0$5ZHj~OW4U^Xk9VXpqq4Xcyju}LPDtx&tROSCcWCbo zR$GJ5RT!5bvn20O^%7eeCRT813e$wLlDxxAsi;4U%B0klFcM_;!8@ucl@sZCZDC?> zCs^&#EzLWuiN_eP`#_l3>6mI=rd01Zky6q2lCJY)eKJX@uo-IfeZS0irYr`3zL(Ud z=VR?^G{n8`T~jKx>G>!-8zsn-m12@o>C8*&goznkY7UmX(us_1taF|v9@mz4lk8J0 z!o-gHLsA@Uu_%+S&G;JwNy&omBA#z~Tv94d>G_zOwB;lWNR_QOOk;V9$-_}ihFJU# z-o`e_*8z?WK#46G$f8BwQ_0QMRxpl%V2FTVh~-tp z>Z33m2jocS`phE^2Zlio$v625mfbtMq&tSYD5e6mIv!7_4z zr^LcEMcIo_0+eO{PWQy0e*ukCG!0xH4=Mlv04;PySaefwW^{L9a%BKwc`jmXZ*OE| uc`jped2n=ZE@^FHXJsx>PDe5{MQ&qnWMy)w27m4V0000%xV#&%V97`Q_z}*~RbHuYI+WuQac( zudII#ATMofZ(Um7J}CkHaCvj~-<50E3)Aqo^55s*tZjag-&%whfWb@zkl%0Yya$kV z5bL(KbGx{D<8JZe?ABSZ*Jq#bJs2GM%?^B3ZgqXO3IM9vxH0?K2P8n;xV>9!-J2IT z9~=~S9vv0;51*bf{2ib9Ve7_Ou*>g<8_!?|ijQ!c6_Dku>H-nK0LaZdd&Tzd!wRsw z2gm1tl-Tw8;|lEhZ&aS499+1+jFQLr*yL6*8+Z2hDqR0Bay;Crd%jwDHk&t6lLiHp4vv>_&1{hLp+0YmDA5 z*NPWGx9S=nV>5Ub4A666Pl=q70Kt9Ht%i<|Fod1duDl1lpaykkT$TpkSZkkQmJp53|z)Wz3T1H z(ux`Y$o2uu9M4wro2pd}fQkY?15N|I7hBV^KEA3$9L zV~Vp^D^H4w`()12P7NDTLpmz!F|}=AOm+5}eO}&*`xG{$^=%geUoTO znRM>E8c&{Fs8^EWe!b8jZEVk#pYh~LqqslUtUIb!>?5}d$)vM2o2LI+T-r9ua7K_P7sY+)(i9ga4L3a%c@Zp@ zagZCPfoEWL+3d9?Rjw-aN?3@oUb$bFEHz6+@iJ0o)F!af{kkx)34B*)3sOmZ2A{=X z!Az~HW0q@ztyk{XB}*xjrmB@`jNR1g zm8)c#QmT|Pu+}U0yNH%#!C4BaQtH53uiWpGEG0}jmZ}oM1UD&V9E^2aU|UnK-0zbt zLpI>~26xCksK(lRQnhklB3VioeUC}9kcNcbb1H^iWa*x*HWqD@ETv3(tQ@#%FP)eh zHn;Kzs15r-udevGC|Sn3Wy93Kg$stb)O50`c_4@Pa~LEWuMAx_)JS_VpP9rn80s5% zo7?k4cnWgL3MEVFX5T1Q584y*hk7z5(kRE-QL?l>=nBl%=enU(z=g+aI@HQ=yC=ciu8m{~cj9_l3SzWNDy8Wa z9*Z2Yg|*S`#(HiriI%TpaS*4qRVPg&+K^`!wUQ&a-I5$deTryZvJ`J&sMw@bLdaqP zw=E|%-ENWxKAYzv`39MUtSL^zosS7F&mU?dM|8VU9slYui|1^_3w7u-2^oMLLs#z2 zNmFvWma5h&7l;QvX{C(QL+Q%QN!!Q~-ENfRC{)@+`4X`xwPR$NlQtdIx{v~=;&xq% z5ZucHFDdquzL}FYlA}|%JJ=b#NyX(;88gN+gWClA!KJ{|FAxsKWyG=3&ki;gWSMRk zgK??duFHj)09O|>m6EdH#bW4k&_yE!P9-i=5YcSn;uBnBDaWTgTLY$21R1V!2$y{Z z+|rZeSv#Rr3gKYUWthPo)@8FufmABQ>EHmDxh#GwgFB+c={uD&!F6r`&zIW;HtRE$ z0)flm#u%49q*7cq>9n#gU&EwQ+T&?WaJ{yU=F4*`by{E6q*CnY&)_B~aUzxKa@mv~ z@%apHda2aMu2jkdH>*<rc$R8XOKQKGBibQV{c?-a;OG>?f?J)07*qoM6N<$f;OR4!~g&Q literal 0 HcmV?d00001 diff --git a/examples/rtree/assets/Red playerShip (1).png b/examples/rtree/assets/Red playerShip (1).png new file mode 100644 index 0000000000000000000000000000000000000000..3695e09e21c6f37cf43dc8dd745b6f8134dc83f4 GIT binary patch literal 2710 zcmV;H3TgF;P)dAwm|g{+DE!bK{iyUdB#n`dMtzZicB0l$8I`|yv0whS)(;sL-`-X$bbV@! zd_K>?OuYTJFEY@MFLOpeD!mOUt@SGSWZ|dM+Yrd0v^FRiD!mOUt%bGi-tCJFw39a{ zsEo=(p&cQV*7_BEqVN;bTVtu(qfmBPPIY#biD~WC>FGdZpuL#hwsrT`DwH=UZ!|RA zT@`6=efQ)StmeyhHj$nRB=}_EchMl_leP|q{;Qf!#omcDtK~{A2Wo1z9&T!>1W2&= znp;_8Y>-V~z7i@K=nws(e;VshQ%fx_0>y$+sv@V#4o9M^1Ws+&8TRe@3#|9z3|sv1 zS|GtE3qSOSe$hY1p)oN&E(Tl_cO(f|BB~-SdVz$_Zq_k6#=#={@u$^L$v}T%{}>PB z3U^5k7ss6y7mW3q065;-!MY4kCg!iOGXhXB%7Xe{c_k1TXit5K{bM|gi}5iJn$xDm zlLL3%wYB1b2P!K|N@B2zl9KAz?z^wF7;)iHq@|i1KGM?0+6EKs+}r{O1SSGCkeRy) zpijXk3qKh87002mF%QfK^D1^c0lvVwfVqJ`c+e^ze6aQPk`gAGQDL?Go_j)@L{($+ zeladI_4b=c;9z7IO&}%a@&y1p_U;Wt2HI0!=vN#kWsGZ@hcPeAuUPQ}xB}mGm>WE3 z^iSQkZQKr*macvH&_lIh#09LwVqAz{oHaR5mXgSrymZ+l_`cb-i=BSzDbI#>qVPk% z;y6j^q9DUOixE$NEAR!*ggJ4b5lfNn+xevNmp**$-g|e36&L!(r!1W&8=0Lqfs|fc zGLg}=`&rib%pT9y@bvR0GSII$&hX5<ej@%D#nHA_wjXc!N~?PSrbUh*H%nq_$2~X zv*Wh~GSII$PXAQa^&H_3{PGh|fFtk(uE3YD2JQti5Xoh>U?(1Xj8{7N>H)_A4>h*z z5#vIASBxbxIoA%70TipWmiE^MA>-(dU4?zOa(XLfRBjFa!B02wguYz>j=&SRia66M z1RiY3fE_tdZn_G@Tl1~@lci!@_^AEc4da57ov}%4A=m(BP%=pPS*5pQ`6XX-hQILJ zDxLr*;3cjWz*EN9Ove59@4-KZ9)5UT#cxiwvM&dd?B8GA9FPXJ5^X`uF0I9W*`Q>U zKlyZF->sYU)~i{GMiDRI2ONQ?j4^QMWEeaYBD@_LUFXu=+TuFx z1(VwM26S&)@wWgKEO%F&Wa35lnNr7a$h%Oz~brfh_KQa^H+Z`X^bFgEe!2N zt%3f{U%g~Q^#}M^;buifLGTswUrG4=++^5kjG&KO?H<3%TEk0v8zvbh!6%ThPWUM@ zicf|~@X2I|!cUP=d@@XePf&-JT0@ahTrx}=Ly>VSl3^qK6dA=O!zB3RuXYs~n?r`_ zQH7oGQ)CpEjCF#Kik0wFWE7W-b%M`H_-#bSSZ;|WXBQM1h5-lQ;g$?b!RI9WHX=ix zxxj`->R3;5g!P=yu)c{|{#jz?64SGn|1ZgaU+@op!e96e|A7PWa7%`z;Byjw8Zd1wlK0U`T6wIgp!W`=zo96TEPqgxRPYwKz`yu-#`|d;ra0H%?8pDnZ+(vKy zaUb6#T;JVqBE<_C{~g@2uFgtw8(U27KiWTa__GH7pyX(@ot=!G4TTK3PIl}sn@UD%qG3az{g45?fE#~o zZQw}zrECSCmGBeyP8}?-C=(weqVx86ia-BNrao6>2nIZW3-BQl=rJsC6!%P73O+00 z_ueCq+}v^~?i!b#?S9noPu6!rV~Ni-cA;ep%Xe(KqsV~2@H^F@aU6h$yjMWn@J71{ zfv>ILlZD^w4tu87w(>W(VxSXsf74?%8k6m8t;Y05jpf=6`+9BCw=)@-Km33{@C*J~ z`3*dP3-Gbpbx0SyXdCVWwN1Hf%6G@Loju32{krvAWqiAr^Xb?M zjDzv8>+fj&`*$AjZVDZ@O)umJeV^tO%by8z|ZvfAp`Ah7fta$6Vbipd#5((0000j zbVXQnQ*UN;cVTj60AhJAVr*}3WMp|RV{&KQKGBibQV{c?-a;OG> Q?f?J)07*qoM6N<$f+-O%kpKVy literal 0 HcmV?d00001 diff --git a/examples/rtree/game.json b/examples/rtree/game.json new file mode 100644 index 000000000..523198d68 --- /dev/null +++ b/examples/rtree/game.json @@ -0,0 +1,1297 @@ +{ + "firstLayout": "", + "gdVersion": { + "build": 99, + "major": 4, + "minor": 0, + "revision": 0 + }, + "properties": { + "adaptGameResolutionAtRuntime": true, + "folderProject": false, + "orientation": "landscape", + "packageName": "com.example.gamename", + "pixelsRounding": false, + "projectUuid": "f5e2e5ef-42bf-401f-935e-8980c937c295", + "scaleMode": "linear", + "sizeOnStartupMode": "", + "templateSlug": "", + "useExternalSourceFiles": false, + "version": "1.0.0", + "name": "R-Tree", + "description": "", + "author": "", + "windowWidth": 1280, + "windowHeight": 720, + "latestCompilationDirectory": "", + "maxFPS": 60, + "minFPS": 20, + "verticalSync": false, + "platformSpecificAssets": {}, + "loadingScreen": { + "backgroundColor": 0, + "backgroundFadeInDuration": 0.2, + "backgroundImageResourceName": "", + "gdevelopLogoStyle": "light", + "logoAndProgressFadeInDuration": 0.2, + "logoAndProgressLogoFadeInDelay": 0.2, + "minDuration": 1.5, + "progressBarColor": 16777215, + "progressBarHeight": 20, + "progressBarMaxWidth": 200, + "progressBarMinWidth": 40, + "progressBarWidthPercent": 30, + "showGDevelopSplash": true, + "showProgressBar": true + }, + "authorIds": [], + "categories": [], + "playableDevices": [], + "extensionProperties": [], + "platforms": [ + { + "name": "GDevelop JS platform" + } + ], + "currentPlatform": "GDevelop JS platform" + }, + "resources": { + "resources": [ + { + "alwaysLoaded": false, + "file": "assets/Red playerShip (1).png", + "kind": "image", + "metadata": "", + "name": "Red playerShip (1).png", + "smoothed": true, + "userAdded": false, + "origin": { + "identifier": "https://asset-resources.gdevelop.io/public-resources/Space Shooter/PNG/b331b3700315a046506f289a74e04b71f3decdd90eaddc6fefdb4af856a05d83_Red playerShip (1).png", + "name": "Red playerShip (1).png" + } + }, + { + "alwaysLoaded": false, + "file": "assets/Big Brown Meteor (1).png", + "kind": "image", + "metadata": "", + "name": "Big Brown Meteor (1).png", + "smoothed": true, + "userAdded": false, + "origin": { + "identifier": "https://asset-resources.gdevelop.io/public-resources/Space Shooter/PNG/Meteors/ae6802c87f6e3e4739b6260b23e4546582daad3fb803446401fbec2bc057f297_Big Brown Meteor (1).png", + "name": "Big Brown Meteor (1).png" + } + }, + { + "alwaysLoaded": false, + "file": "assets/Big Grey Meteor (2).png", + "kind": "image", + "metadata": "", + "name": "Big Grey Meteor (2).png", + "smoothed": true, + "userAdded": false, + "origin": { + "identifier": "https://asset-resources.gdevelop.io/public-resources/Space Shooter/PNG/Meteors/401dea3495a58458e490689209f4c600652397a44bfc31314e80d0af334173aa_Big Grey Meteor (2).png", + "name": "Big Grey Meteor (2).png" + } + } + ], + "resourceFolders": [] + }, + "objects": [], + "objectsGroups": [], + "variables": [], + "layouts": [ + { + "b": 37, + "disableInputWhenNotFocused": true, + "mangledName": "Untitled_32scene", + "name": "Untitled scene", + "r": 37, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 37, + "uiSettings": { + "grid": false, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": false, + "zoomFactor": 0.546875, + "windowMask": false + }, + "objectsGroups": [ + { + "name": "Obstacle", + "objects": [ + { + "name": "BigBrownMeteor1" + }, + { + "name": "BigGreyMeteor2" + } + ] + } + ], + "variables": [], + "instances": [ + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "RedPlayerShip1", + "persistentUuid": "9ff2bb0e-b2eb-4b93-81af-c0444469469c", + "width": 0, + "x": 485, + "y": 369, + "zOrder": 1, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "f9c940ba-9f2e-4b8f-8333-a872187bf521", + "width": 0, + "x": 983, + "y": 85, + "zOrder": 2, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "1944b1e4-d9cc-4207-8108-202660699298", + "width": 0, + "x": 413, + "y": 149, + "zOrder": 3, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "ef6ae8ec-e101-48dc-83cd-80cd9339c82f", + "width": 0, + "x": 691, + "y": 515, + "zOrder": 4, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "29c24acd-7e01-4587-9e78-ec611f1f1f90", + "width": 0, + "x": 115, + "y": 524, + "zOrder": 5, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "20553e7b-6091-412f-99e3-744417a7a1f6", + "width": 0, + "x": 1073, + "y": 494, + "zOrder": 6, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "128cd2f9-0397-44ad-9d5d-7ce7e37276c8", + "width": 0, + "x": 186, + "y": 268, + "zOrder": 7, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "517150aa-0fbf-4512-b563-c6f08042dba6", + "width": 0, + "x": 685, + "y": 211, + "zOrder": 8, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigGreyMeteor2", + "persistentUuid": "a164943d-79ef-4648-bc7f-58e942730210", + "width": 0, + "x": 166, + "y": 111, + "zOrder": 9, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigGreyMeteor2", + "persistentUuid": "13e04f7b-6347-4bcd-b6f5-99211f26821d", + "width": 0, + "x": 903, + "y": 292, + "zOrder": 10, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigGreyMeteor2", + "persistentUuid": "33b31ac4-6bda-4013-b3cb-2749c5414f1b", + "width": 0, + "x": 404, + "y": 574, + "zOrder": 11, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "objects": [ + { + "assetStoreId": "2b2dfbbe01d820384d341ecfa1cf553b2700019a4f78c1d6fc4c55cb4b373bf5", + "name": "RedPlayerShip1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Red playerShip (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "911c6f50a4c05507c6fc1df967493f61a7ce9bad9e144cec92f6ff32be42749a", + "name": "BigBrownMeteor1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Brown Meteor (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "fe9de3e97f21ea1ff6d364d2efe3e7d379cb150152cc2461b10d1ed05f803d09", + "name": "BigGreyMeteor2", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Grey Meteor (2).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DepartScene" + }, + "parameters": [ + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "640", + "0", + "1280", + "720", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "DebuggerTools::ConsoleLog" + }, + "parameters": [ + "\"Brown: \" + ToString(PickedInstancesCount(BigBrownMeteor1))", + "", + "" + ] + }, + { + "type": { + "value": "DebuggerTools::ConsoleLog" + }, + "parameters": [ + "\"Grey: \" + ToString(PickedInstancesCount(BigGreyMeteor2))", + "", + "" + ] + } + ] + } + ] + } + ], + "layers": [ + { + "ambientLightColorB": 0, + "ambientLightColorG": 9943112, + "ambientLightColorR": 16, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "name": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "behaviorsSharedData": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ] + } + ], + "externalEvents": [], + "eventsFunctionsExtensions": [ + { + "author": "", + "category": "Movement", + "extensionNamespace": "", + "fullName": "Collision detector", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXNldC1ub25lIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTksNUE3LDcgMCAwLDAgMiwxMkE3LDcgMCAwLDAgOSwxOUMxMC4wNCwxOSAxMS4wNiwxOC43NiAxMiwxOC4zMkMxMi45NCwxOC43NiAxMy45NiwxOSAxNSwxOUE3LDcgMCAwLDAgMjIsMTJBNyw3IDAgMCwwIDE1LDVDMTMuOTYsNSAxMi45NCw1LjI0IDEyLDUuNjhDMTEuMDYsNS4yNCAxMC4wNCw1IDksNU05LDdDOS4zNCw3IDkuNjcsNy4wMyAxMCw3LjFDOC43Miw4LjQxIDgsMTAuMTcgOCwxMkM4LDEzLjgzIDguNzIsMTUuNTkgMTAsMTYuODlDOS42NywxNi45NiA5LjM0LDE3IDksMTdBNSw1IDAgMCwxIDQsMTJBNSw1IDAgMCwxIDksN00xNSw3QTUsNSAwIDAsMSAyMCwxMkE1LDUgMCAwLDEgMTUsMTdDMTQuNjYsMTcgMTQuMzMsMTYuOTcgMTQsMTYuOUMxNS4yOCwxNS41OSAxNiwxMy44MyAxNiwxMkMxNiwxMC4xNyAxNS4yOCw4LjQxIDE0LDcuMTFDMTQuMzMsNy4wNCAxNC42Niw3IDE1LDdNMTIsOEMxMy4yNiw4Ljk1IDE0LDEwLjQzIDE0LDEyQzE0LDEzLjU3IDEzLjI2LDE1LjA1IDEyLDE2QzEwLjc0LDE1LjA1IDEwLDEzLjU3IDEwLDEyQzEwLDEwLjQzIDEwLjc0LDguOTUgMTIsOFoiIC8+PC9zdmc+", + "name": "CollisionDetector", + "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/f0512bd0e942826426e57926e62a6354b2d01670b5f3bdb086b1fb62b060c607_set-none.svg", + "shortDescription": "", + "version": "0.1.0", + "description": "", + "origin": { + "identifier": "BoidsMovement", + "name": "gdevelop-extension-store" + }, + "tags": [ + "collision", + "obstacle", + "solid", + "r-tree" + ], + "authorIds": [ + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" + ], + "dependencies": [], + "eventsFunctions": [ + { + "description": "Declare JavaScript library.", + "fullName": "Declare JavaScript library", + "functionType": "Action", + "name": "DeclareJavaScriptLibrary", + "private": true, + "sentence": "Declare JavaScript library", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "CollisionDetector::IsJavaScriptLibraryDeclared" + }, + "parameters": [ + "", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "gdjs.__collisionDetectorExtension = gdjs.__collisionDetectorExtension || {};", + "", + "/**", + " * ", + " */", + "gdjs.__collisionDetectorExtension.SolidManager = /** @class */ (function () {", + " /**", + " * Create a manager.", + " */", + " function SolidManager() {", + " this.rBushes = new Map();", + " }", + "", + " /**", + " * Add a boid to the R-Tree.", + " * @param {gdjs.RuntimeBehavior} behavior", + " */", + " SolidManager.prototype.add = function (behavior) {", + " if (behavior.currentRBushAABB) {", + " behavior.currentRBushAABB.updateAABBFromOwner();", + " }", + " else {", + " behavior.currentRBushAABB = new gdjs.BehaviorRBushAABB(", + " behavior", + " );", + " }", + " const rBush = this.getRBush(behavior.owner.getName());", + " rBush.insert(behavior.currentRBushAABB);", + " }", + "", + " /**", + " * Remove a boid from the R-Tree.", + " * @param {gdjs.RuntimeBehavior} behavior", + " */", + " SolidManager.prototype.remove = function (behavior) {", + " const rBush = this.getRBush(behavior.owner.getName());", + " rBush.remove(behavior.currentRBushAABB);", + " }", + "", + " SolidManager.prototype.getRBush = function (objectName) {", + " let rBush = this.rBushes.get(objectName);", + " if (!rBush) {", + " rBush = new rbush();", + " this.rBushes.set(objectName, rBush);", + " }", + " return rBush;", + " }", + "", + " /**", + " * Returns all the instances around the specified area.", + " * @param {string} objectName", + " * @param {number} left", + " * @param {number} top", + " * @param {number} right", + " * @param {number} bottom", + " * @param {gdjs.RuntimeObject[]} results", + " * @return {gdjs.RuntimeObject[]} An array with all boids near the object.", + " */", + " SolidManager.prototype.getAllInstancesInRectangle = function (objectName, left, top, right, bottom, results) {", + " const searchArea = gdjs.staticObject(", + " gdjs.__collisionDetectorExtension.SolidManager.prototype.getAllInstancesInRectangle", + " );", + " searchArea.minX = left;", + " searchArea.minY = top;", + " searchArea.maxX = right;", + " searchArea.maxY = bottom;", + " const rBush = this.getRBush(objectName);", + " // TODO The R-Tree should not allocate an array.", + " const nearbys = rBush.search(searchArea);", + " results.length = 0;", + " results.push.apply(results, nearbys);", + " return results;", + " }", + "", + " return SolidManager;", + "}());", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ] + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "description": "Check if JavaScript library is declared.", + "fullName": "JavaScript library declared", + "functionType": "Condition", + "name": "IsJavaScriptLibraryDeclared", + "private": true, + "sentence": "JavaScript library is declared", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": "eventsFunctionContext.returnValue = !!gdjs.__collisionDetectorExtension;", + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "description": "Check if obstacles are around a rectanglular area.", + "fullName": "Is around rectangle", + "functionType": "Condition", + "name": "IsAroundRectangle", + "sentence": "_PARAM1_ is around a rectangle (left: _PARAM3_, top: _PARAM4_, right: _PARAM5_, bottom: _PARAM6_)", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "\r", + "runtimeScene.__collisionDetectorExtension = runtimeScene.__collisionDetectorExtension || {};\r", + "runtimeScene.__collisionDetectorExtension.solidManager =\r", + " runtimeScene.__collisionDetectorExtension.solidManager || new gdjs.__collisionDetectorExtension.SolidManager();\r", + "const manager = runtimeScene.__collisionDetectorExtension.solidManager;\r", + "\r", + "const objectsLists = eventsFunctionContext.getObjectsLists(\"Object\");\r", + "\r", + "const left = eventsFunctionContext.getArgument(\"Left\");\r", + "const top = eventsFunctionContext.getArgument(\"Top\");\r", + "const right = eventsFunctionContext.getArgument(\"Right\");\r", + "const bottom = eventsFunctionContext.getArgument(\"Bottom\");\r", + "\r", + "for (const objectName in objectsLists.items) {\r", + " const objects = objectsLists.items[objectName];\r", + " manager.getAllInstancesInRectangle(objectName, left, top, right, bottom, objects);\r", + "}\r", + "eventsFunctionContext.returnValue = true;" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "objectList" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + }, + { + "description": "Left bound", + "name": "Left", + "type": "expression" + }, + { + "description": "Top bound", + "name": "Top", + "type": "expression" + }, + { + "description": "Right bound", + "name": "Right", + "type": "expression" + }, + { + "description": "Bottom bound", + "name": "Bottom", + "type": "expression" + } + ], + "objectGroups": [] + } + ], + "eventsBasedBehaviors": [ + { + "description": "Can be serched efficiently.", + "fullName": "Solid", + "name": "Solid", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CollisionDetector::DeclareJavaScriptLibrary" + }, + "parameters": [ + "", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "runtimeScene.__collisionDetectorExtension = runtimeScene.__collisionDetectorExtension || {};", + "runtimeScene.__collisionDetectorExtension.solidManager =", + " runtimeScene.__collisionDetectorExtension.solidManager || new gdjs.__collisionDetectorExtension.SolidManager();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CollisionDetector::Solid::AddToTree" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onActivate", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CollisionDetector::Solid::AddToTree" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onDeActivate", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CollisionDetector::Solid::RemoveFromTree" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onDestroy", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CollisionDetector::Solid::RemoveFromTree" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "CollisionDetector::Solid::PropertyPreviousX" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "Object.X()" + ] + }, + { + "type": { + "value": "CollisionDetector::Solid::PropertyPreviousY" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "Object.Y()" + ] + }, + { + "type": { + "value": "CollisionDetector::Solid::PropertyPreviousWidth" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "Object.Width()" + ] + }, + { + "type": { + "value": "CollisionDetector::Solid::PropertyPreviousHeight" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "Object.Height()" + ] + }, + { + "type": { + "value": "CollisionDetector::Solid::PropertyPreviousAngle" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "Object.Angle()" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "CollisionDetector::Solid::UpdateInTree" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "CollisionDetector::Solid::SetPropertyPreviousX" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.X()" + ] + }, + { + "type": { + "value": "CollisionDetector::Solid::SetPropertyPreviousY" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.Y()" + ] + }, + { + "type": { + "value": "CollisionDetector::Solid::SetPropertyPreviousWidth" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.Width()" + ] + }, + { + "type": { + "value": "CollisionDetector::Solid::SetPropertyPreviousHeight" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.Height()" + ] + }, + { + "type": { + "value": "CollisionDetector::Solid::SetPropertyPreviousAngle" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.Angle()" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Update the object position in the tree", + "fullName": "Update in the tree", + "functionType": "Action", + "name": "UpdateInTree", + "private": true, + "sentence": "Update _PARAM0_ in the tree", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CollisionDetector::Solid::RemoveFromTree" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "CollisionDetector::Solid::AddToTree" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Add the object position in the tree", + "fullName": "Add to the tree", + "functionType": "Action", + "name": "AddToTree", + "private": true, + "sentence": "Add _PARAM0_ to the tree", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "const behavior = object.getBehavior(behaviorName);\r", + "\r", + "runtimeScene.__collisionDetectorExtension.solidManager.add(behavior);" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Remove the object from the tree", + "fullName": "Remove from the tree", + "functionType": "Action", + "name": "RemoveFromTree", + "private": true, + "sentence": "Remove _PARAM0_ from the tree", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "const behavior = object.getBehavior(behaviorName);\r", + "\r", + "runtimeScene.__collisionDetectorExtension.solidManager.remove(behavior);" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "PreviousX" + }, + { + "value": "", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "PreviousY" + }, + { + "value": "", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "PreviousWidth" + }, + { + "value": "", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "PreviousHeight" + }, + { + "value": "", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "PreviousAngle" + } + ], + "sharedPropertyDescriptors": [] + } + ], + "eventsBasedObjects": [] + } + ], + "externalLayouts": [], + "externalSourceFiles": [] +} \ No newline at end of file From acf31d656db653e4da07ab9be1e38b50ea8425f9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 28 Dec 2022 00:41:07 +0000 Subject: [PATCH 02/11] Optimised images with calibre/image-actions --- .../rtree/assets/Big Brown Meteor (1).png | Bin 1804 -> 1768 bytes examples/rtree/assets/Big Grey Meteor (2).png | Bin 2310 -> 2274 bytes examples/rtree/assets/Red playerShip (1).png | Bin 2710 -> 2674 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/examples/rtree/assets/Big Brown Meteor (1).png b/examples/rtree/assets/Big Brown Meteor (1).png index 31e06a4895c2f2b958aa13b664b40a385b3507a4..10e2149e719af80bc45da47d1e201169145649da 100644 GIT binary patch delta 40 tcmeC-d%-(FS(t&dz$3Dlfq`2Hgc&d0t^2c4aU~lkgQu&X%Q~loCIH_93&Q{a delta 77 zcmaFC+ru|Od85U0HYeQ@*NBqf{Irtt#G+J&q)NS{oc#QhluEtiqRN7je7(%v#Pn3X f06%vl6W6@t{FKz96>RnI7=Xaj)z4*}Q$iB}N&_2I diff --git a/examples/rtree/assets/Big Grey Meteor (2).png b/examples/rtree/assets/Big Grey Meteor (2).png index bcc8dc75474a9d3d8a5fa4135f19ec1245083212..204b568575ed94802b75a4e9736a06fc08a2a0fd 100644 GIT binary patch delta 40 tcmZn@dL%eOS(t&dz$3Dlfq`2Hgc&d0t^2c4aWMxcgQu&X%Q~loCIH?o3%dXS delta 77 zcmaDP*d{bVd85Tb4kz6b*NBqf{Irtt#G+J&q)NS{oc#QhluEtiqRN7je7(%v#Pn3X f06%vl6W6@t{FKz96>RnI7=Xaj)z4*}Q$iB}N3|PF diff --git a/examples/rtree/assets/Red playerShip (1).png b/examples/rtree/assets/Red playerShip (1).png index 3695e09e21c6f37cf43dc8dd745b6f8134dc83f4..213f1be09db97d002aec20fc919718185a83518e 100644 GIT binary patch delta 40 tcmbOx`blJhvM>W@fk$L90|U1Z2s2)~TlZ(9qA?dIgQu&X%Q~loCIH^Y3v&Pf delta 77 zcmew)GEH=X@RnI7=Xaj)z4*}Q$iB}HBTD^ From 66f6785e9741b7c85f99494a8d43a7c94d020669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davy=20H=C3=A9lard?= Date: Wed, 28 Dec 2022 02:39:56 +0100 Subject: [PATCH 03/11] Add a separate action. --- examples/rtree/game.json | 451 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 450 insertions(+), 1 deletion(-) diff --git a/examples/rtree/game.json b/examples/rtree/game.json index 523198d68..a71907030 100644 --- a/examples/rtree/game.json +++ b/examples/rtree/game.json @@ -103,6 +103,397 @@ "objectsGroups": [], "variables": [], "layouts": [ + { + "b": 37, + "disableInputWhenNotFocused": true, + "mangledName": "Untitled_32scene2", + "name": "Untitled scene2", + "r": 37, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 37, + "uiSettings": { + "grid": false, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": false, + "zoomFactor": 0.546875, + "windowMask": false + }, + "objectsGroups": [ + { + "name": "Obstacle", + "objects": [ + { + "name": "BigBrownMeteor1" + }, + { + "name": "BigGreyMeteor2" + } + ] + } + ], + "variables": [], + "instances": [ + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "f9c940ba-9f2e-4b8f-8333-a872187bf521", + "width": 0, + "x": 983, + "y": 85, + "zOrder": 2, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "1944b1e4-d9cc-4207-8108-202660699298", + "width": 0, + "x": 504, + "y": 293, + "zOrder": 3, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "ef6ae8ec-e101-48dc-83cd-80cd9339c82f", + "width": 0, + "x": 960, + "y": 138, + "zOrder": 4, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "29c24acd-7e01-4587-9e78-ec611f1f1f90", + "width": 0, + "x": 157, + "y": 316, + "zOrder": 5, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "20553e7b-6091-412f-99e3-744417a7a1f6", + "width": 0, + "x": 1040, + "y": 121, + "zOrder": 6, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "128cd2f9-0397-44ad-9d5d-7ce7e37276c8", + "width": 0, + "x": 186, + "y": 268, + "zOrder": 7, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "517150aa-0fbf-4512-b563-c6f08042dba6", + "width": 0, + "x": 570, + "y": 271, + "zOrder": 8, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigGreyMeteor2", + "persistentUuid": "a164943d-79ef-4648-bc7f-58e942730210", + "width": 0, + "x": 903, + "y": 87, + "zOrder": 9, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigGreyMeteor2", + "persistentUuid": "13e04f7b-6347-4bcd-b6f5-99211f26821d", + "width": 0, + "x": 642, + "y": 283, + "zOrder": 10, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigGreyMeteor2", + "persistentUuid": "33b31ac4-6bda-4013-b3cb-2749c5414f1b", + "width": 0, + "x": 550, + "y": 327, + "zOrder": 11, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "objects": [ + { + "assetStoreId": "2b2dfbbe01d820384d341ecfa1cf553b2700019a4f78c1d6fc4c55cb4b373bf5", + "name": "RedPlayerShip1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Red playerShip (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "911c6f50a4c05507c6fc1df967493f61a7ce9bad9e144cec92f6ff32be42749a", + "name": "BigBrownMeteor1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Brown Meteor (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "fe9de3e97f21ea1ff6d364d2efe3e7d379cb150152cc2461b10d1ed05f803d09", + "name": "BigGreyMeteor2", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Grey Meteor (2).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DepartScene" + }, + "parameters": [ + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CollisionDetector::Separate" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "Obstacle", + "" + ] + } + ] + } + ] + } + ], + "layers": [ + { + "ambientLightColorB": 0, + "ambientLightColorG": 9943112, + "ambientLightColorR": 16, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "name": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "behaviorsSharedData": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ] + }, { "b": 37, "disableInputWhenNotFocused": true, @@ -660,7 +1051,7 @@ " // TODO The R-Tree should not allocate an array.", " const nearbys = rBush.search(searchArea);", " results.length = 0;", - " results.push.apply(results, nearbys);", + " nearbys.forEach(nearby => results.push(nearby.behavior.owner));", " return results;", " }", "", @@ -765,6 +1156,64 @@ } ], "objectGroups": [] + }, + { + "description": "Move an object away from another using collision masks.", + "fullName": "Separate objects", + "functionType": "Action", + "name": "Separate", + "sentence": "Move _PARAM1_ away from _PARAM2_ (only _PARAM1_ move)", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "\r", + "runtimeScene.__collisionDetectorExtension = runtimeScene.__collisionDetectorExtension || {};\r", + "runtimeScene.__collisionDetectorExtension.solidManager =\r", + " runtimeScene.__collisionDetectorExtension.solidManager || new gdjs.__collisionDetectorExtension.SolidManager();\r", + "const manager = runtimeScene.__collisionDetectorExtension.solidManager;\r", + "\r", + "const objects = eventsFunctionContext.getObjects(\"Object\");\r", + "const solidObjectLists = eventsFunctionContext.getObjectsLists(\"SolidObject\");\r", + "\r", + "const nearObjects = []\r", + "for (const object of objects) {\r", + " const left = object.getAABBLeft();\r", + " const top = object.getAABBTop();\r", + " const right = object.getAABBRight();\r", + " const bottom = object.getAABBBottom();\r", + " for (const objectName in solidObjectLists.items) {\r", + " // Solid picking is ignored all solid are considered.\r", + " nearObjects.length = 0;\r", + " manager.getAllInstancesInRectangle(objectName, left, top, right, bottom, nearObjects);\r", + " object.separateFromObjects(nearObjects);\r", + " }\r", + "}" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "objectList" + }, + { + "description": "Object (won't move)", + "name": "SolidObject", + "type": "objectList" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + } + ], + "objectGroups": [] } ], "eventsBasedBehaviors": [ From e859a59e2d80d907d73c1d423f640ab9b76410b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davy=20H=C3=A9lard?= Date: Wed, 28 Dec 2022 14:16:55 +0100 Subject: [PATCH 04/11] Handle pre picking. --- examples/rtree/game.json | 47 ++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/examples/rtree/game.json b/examples/rtree/game.json index a71907030..5114e34ef 100644 --- a/examples/rtree/game.json +++ b/examples/rtree/game.json @@ -491,6 +491,14 @@ { "name": "Obstacle", "type": "CollisionDetector::Solid" + }, + { + "name": "Physics2", + "type": "Physics2::Physics2Behavior", + "gravityX": 0, + "gravityY": 9.8, + "scaleX": 100, + "scaleY": 100 } ] }, @@ -1104,16 +1112,30 @@ " runtimeScene.__collisionDetectorExtension.solidManager || new gdjs.__collisionDetectorExtension.SolidManager();\r", "const manager = runtimeScene.__collisionDetectorExtension.solidManager;\r", "\r", - "const objectsLists = eventsFunctionContext.getObjectsLists(\"Object\");\r", + "const solidObjectsLists = eventsFunctionContext.getObjectsLists(\"Object\");\r", "\r", "const left = eventsFunctionContext.getArgument(\"Left\");\r", "const top = eventsFunctionContext.getArgument(\"Top\");\r", "const right = eventsFunctionContext.getArgument(\"Right\");\r", "const bottom = eventsFunctionContext.getArgument(\"Bottom\");\r", "\r", - "for (const objectName in objectsLists.items) {\r", - " const objects = objectsLists.items[objectName];\r", - " manager.getAllInstancesInRectangle(objectName, left, top, right, bottom, objects);\r", + "for (const solidObjectName in solidObjectsLists.items) {\r", + " const pickedObjects = solidObjectsLists.items[solidObjectName];\r", + " if (pickedObjects.length === runtimeScene.getInstancesCountOnScene(solidObjectName)) {\r", + " manager.getAllInstancesInRectangle(solidObjectName, left, top, right, bottom, pickedObjects);\r", + " }\r", + " else {\r", + " // TODO avoid alloction\r", + " const objects = [...pickedObjects];\r", + " pickedObjects.length = 0;\r", + " objects.forEach(pickedObject => {\r", + " const aabb = pickedObject.getAABB();\r", + " if (left < aabb.max[0] && aabb.min[0] < right\r", + " && top < aabb.max[1] && aabb.min[1] < bottom) {\r", + " pickedObjects.push(pickedObject);\r", + " }\r", + " });\r", + " }\r", "}\r", "eventsFunctionContext.returnValue = true;" ], @@ -1182,11 +1204,18 @@ " const top = object.getAABBTop();\r", " const right = object.getAABBRight();\r", " const bottom = object.getAABBBottom();\r", - " for (const objectName in solidObjectLists.items) {\r", - " // Solid picking is ignored all solid are considered.\r", - " nearObjects.length = 0;\r", - " manager.getAllInstancesInRectangle(objectName, left, top, right, bottom, nearObjects);\r", - " object.separateFromObjects(nearObjects);\r", + " for (const solidObjectName in solidObjectLists.items) {\r", + " const pickedObjects = solidObjectLists.items[solidObjectName];\r", + " if (pickedObjects.length === runtimeScene.getInstancesCountOnScene(solidObjectName)) {\r", + " nearObjects.length = 0;\r", + " manager.getAllInstancesInRectangle(solidObjectName, left, top, right, bottom, nearObjects);\r", + " object.separateFromObjects(nearObjects);\r", + " }\r", + " else {\r", + " // Avoid to do intersection between pickedObjects and nearObjects\r", + " // as it is O(n²) and the naive collision is O(n).\r", + " object.separateFromObjects(pickedObjects);\r", + " }\r", " }\r", "}" ], From cecb1d9d0b53e220a47dcf84d5f2fb0c29632ae8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davy=20H=C3=A9lard?= Date: Wed, 28 Dec 2022 17:10:54 +0100 Subject: [PATCH 05/11] Add a fat box. --- examples/rtree/game.json | 158 ++++++++++++++++++++++++++++++--------- 1 file changed, 124 insertions(+), 34 deletions(-) diff --git a/examples/rtree/game.json b/examples/rtree/game.json index 5114e34ef..52624c6d2 100644 --- a/examples/rtree/game.json +++ b/examples/rtree/game.json @@ -989,12 +989,19 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "gdjs.__collisionDetectorExtension = gdjs.__collisionDetectorExtension || {};", + "/**", + " * @param {gdjs.BehaviorRBushAABB} fatAABB", + " * @param {gdjs.AABB} aabb", + " */", + "const includesAABB = function(fatAABB, aabb) {", + " return fatAABB.minX <= aabb.min[0] && aabb.max[0] <= fatAABB.maxX", + " && fatAABB.minY <= aabb.min[1] && aabb.max[1] <= fatAABB.maxY;", + "}", "", "/**", " * ", " */", - "gdjs.__collisionDetectorExtension.SolidManager = /** @class */ (function () {", + "const SolidManager = /** @class */ (function () {", " /**", " * Create a manager.", " */", @@ -1003,30 +1010,53 @@ " }", "", " /**", - " * Add a boid to the R-Tree.", + " * Add an object to the R-Tree.", " * @param {gdjs.RuntimeBehavior} behavior", " */", " SolidManager.prototype.add = function (behavior) {", - " if (behavior.currentRBushAABB) {", - " behavior.currentRBushAABB.updateAABBFromOwner();", - " }", - " else {", + " if (!behavior.currentRBushAABB) {", " behavior.currentRBushAABB = new gdjs.BehaviorRBushAABB(", " behavior", " );", " }", + " //behavior.currentRBushAABB.updateAABBFromOwner();", + " const aabb = behavior.owner.getAABB();", + " const fatFactor = behavior._getFatFactor();", + " const marginX = fatFactor * (aabb.min[0] - aabb.max[0]);", + " const marginY = fatFactor * (aabb.min[1] - aabb.max[1]);", + " const fatAABB = behavior.currentRBushAABB;", + " fatAABB.minX = aabb.min[0] - marginX;", + " fatAABB.minY = aabb.min[1] - marginY;", + " fatAABB.maxX = aabb.max[0] + marginX;", + " fatAABB.maxY = aabb.max[1] + marginY;", + " ", " const rBush = this.getRBush(behavior.owner.getName());", - " rBush.insert(behavior.currentRBushAABB);", + " rBush.insert(fatAABB);", " }", "", " /**", - " * Remove a boid from the R-Tree.", + " * Remove an object from the R-Tree.", " * @param {gdjs.RuntimeBehavior} behavior", " */", " SolidManager.prototype.remove = function (behavior) {", " const rBush = this.getRBush(behavior.owner.getName());", " rBush.remove(behavior.currentRBushAABB);", " }", + " ", + " /**", + " * Update an object to the R-Tree.", + " * @param {gdjs.RuntimeBehavior} behavior", + " */", + " SolidManager.prototype.update = function (behavior) {", + " const fatAABB = behavior.currentRBushAABB;", + " const aabb = behavior.owner.getAABB();", + "", + " if (!includesAABB(fatAABB, aabb)) {", + " const rBush = this.getRBush(behavior.owner.getName());", + " this.remove(behavior);", + " this.add(behavior);", + " }", + " }", "", " SolidManager.prototype.getRBush = function (objectName) {", " let rBush = this.rBushes.get(objectName);", @@ -1049,7 +1079,7 @@ " */", " SolidManager.prototype.getAllInstancesInRectangle = function (objectName, left, top, right, bottom, results) {", " const searchArea = gdjs.staticObject(", - " gdjs.__collisionDetectorExtension.SolidManager.prototype.getAllInstancesInRectangle", + " SolidManager.prototype.getAllInstancesInRectangle", " );", " searchArea.minX = left;", " searchArea.minY = top;", @@ -1065,6 +1095,9 @@ "", " return SolidManager;", "}());", + "", + "gdjs.__collisionDetectorExtension = gdjs.__collisionDetectorExtension || {};", + "gdjs.__collisionDetectorExtension.SolidManager = SolidManager;", "" ], "parameterObjects": "", @@ -1284,6 +1317,35 @@ "useStrict": true, "eventsSheetExpanded": false }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::Solid::PropertySolidType" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Static\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "CollisionDetector::Solid::SetPropertyFatFactor" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], @@ -1437,6 +1499,23 @@ "sentence": "", "events": [ { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CollisionDetector::Solid::UpdateInTree" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + }, + { + "disabled": true, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { @@ -1596,30 +1675,17 @@ "sentence": "Update _PARAM0_ in the tree", "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "CollisionDetector::Solid::RemoveFromTree" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "type": { - "value": "CollisionDetector::Solid::AddToTree" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "const behavior = object.getBehavior(behaviorName);\r", + "\r", + "runtimeScene.__collisionDetectorExtension.solidManager.update(behavior);" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false } ], "parameters": [ @@ -1762,6 +1828,30 @@ "extraInformation": [], "hidden": true, "name": "PreviousAngle" + }, + { + "value": "0.5", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "FatFactor" + }, + { + "value": "Automatic", + "type": "Choice", + "label": "Type", + "description": "", + "group": "", + "extraInformation": [ + "Automatic", + "Mobile", + "Static" + ], + "hidden": false, + "name": "SolidType" } ], "sharedPropertyDescriptors": [] From 0226b8e5eddbdec4ecf85b89fbcdcc90e0521d14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davy=20H=C3=A9lard?= Date: Wed, 28 Dec 2022 17:56:27 +0100 Subject: [PATCH 06/11] Fix fat box. --- examples/rtree/game.json | 3271 +++++++++++++++++++++++++++++++++++--- 1 file changed, 3037 insertions(+), 234 deletions(-) diff --git a/examples/rtree/game.json b/examples/rtree/game.json index 52624c6d2..38b2f218b 100644 --- a/examples/rtree/game.json +++ b/examples/rtree/game.json @@ -106,8 +106,8 @@ { "b": 37, "disableInputWhenNotFocused": true, - "mangledName": "Untitled_32scene2", - "name": "Untitled scene2", + "mangledName": "Separate_32moving", + "name": "Separate moving", "r": 37, "standardSortMethod": true, "stopSoundsOnStartup": true, @@ -140,158 +140,7 @@ } ], "variables": [], - "instances": [ - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigBrownMeteor1", - "persistentUuid": "f9c940ba-9f2e-4b8f-8333-a872187bf521", - "width": 0, - "x": 983, - "y": 85, - "zOrder": 2, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigBrownMeteor1", - "persistentUuid": "1944b1e4-d9cc-4207-8108-202660699298", - "width": 0, - "x": 504, - "y": 293, - "zOrder": 3, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigBrownMeteor1", - "persistentUuid": "ef6ae8ec-e101-48dc-83cd-80cd9339c82f", - "width": 0, - "x": 960, - "y": 138, - "zOrder": 4, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigBrownMeteor1", - "persistentUuid": "29c24acd-7e01-4587-9e78-ec611f1f1f90", - "width": 0, - "x": 157, - "y": 316, - "zOrder": 5, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigBrownMeteor1", - "persistentUuid": "20553e7b-6091-412f-99e3-744417a7a1f6", - "width": 0, - "x": 1040, - "y": 121, - "zOrder": 6, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigBrownMeteor1", - "persistentUuid": "128cd2f9-0397-44ad-9d5d-7ce7e37276c8", - "width": 0, - "x": 186, - "y": 268, - "zOrder": 7, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigBrownMeteor1", - "persistentUuid": "517150aa-0fbf-4512-b563-c6f08042dba6", - "width": 0, - "x": 570, - "y": 271, - "zOrder": 8, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigGreyMeteor2", - "persistentUuid": "a164943d-79ef-4648-bc7f-58e942730210", - "width": 0, - "x": 903, - "y": 87, - "zOrder": 9, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigGreyMeteor2", - "persistentUuid": "13e04f7b-6347-4bcd-b6f5-99211f26821d", - "width": 0, - "x": 642, - "y": 283, - "zOrder": 10, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigGreyMeteor2", - "persistentUuid": "33b31ac4-6bda-4013-b3cb-2749c5414f1b", - "width": 0, - "x": 550, - "y": 327, - "zOrder": 11, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - } - ], + "instances": [], "objects": [ { "assetStoreId": "2b2dfbbe01d820384d341ecfa1cf553b2700019a4f78c1d6fc4c55cb4b373bf5", @@ -345,7 +194,19 @@ "behaviors": [ { "name": "Obstacle", - "type": "CollisionDetector::Solid" + "type": "CollisionDetector::Solid", + "SolidType": "Mobile" + }, + { + "name": "ScreenWrap", + "type": "ScreenWrap::ScreenWrap", + "HorizontalWrapping": true, + "VerticalWrapping": true, + "BorderTop": 0, + "BorderLeft": 0, + "BorderRight": 0, + "BorderBottom": 0, + "TriggerOffset": 0 } ], "animations": [ @@ -391,7 +252,19 @@ "behaviors": [ { "name": "Obstacle", - "type": "CollisionDetector::Solid" + "type": "CollisionDetector::Solid", + "SolidType": "Mobile" + }, + { + "name": "ScreenWrap", + "type": "ScreenWrap::ScreenWrap", + "HorizontalWrapping": true, + "VerticalWrapping": true, + "BorderTop": 0, + "BorderLeft": 0, + "BorderRight": 0, + "BorderBottom": 0, + "TriggerOffset": 0 } ], "animations": [ @@ -443,24 +316,104 @@ "actions": [], "events": [ { - "type": "BuiltinCommonInstructions::Standard", + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "256", "conditions": [], "actions": [ { "type": { - "value": "CollisionDetector::Separate" + "value": "Create" }, "parameters": [ "", - "Obstacle", - "Obstacle", - "Obstacle", + "BigBrownMeteor1", + "RandomInRange(0, 1280)", + "RandomInRange(0, 720)", + "" + ] + }, + { + "type": { + "value": "AddForceAL" + }, + "parameters": [ + "BigBrownMeteor1", + "Random(360)", + "100", + "1" + ] + }, + { + "type": { + "value": "ChangeScale" + }, + "parameters": [ + "BigBrownMeteor1", + "=", + "0.25" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "128", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "BigGreyMeteor2", + "RandomInRange(0, 1280)", + "RandomInRange(0, 720)", "" ] + }, + { + "type": { + "value": "AddForceAL" + }, + "parameters": [ + "BigGreyMeteor2", + "Random(360)", + "100", + "1" + ] + }, + { + "type": { + "value": "ChangeScale" + }, + "parameters": [ + "BigGreyMeteor2", + "=", + "0.25" + ] } ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CollisionDetector::Separate" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "Obstacle", + "" + ] + } + ] } ], "layers": [ @@ -493,20 +446,16 @@ "type": "CollisionDetector::Solid" }, { - "name": "Physics2", - "type": "Physics2::Physics2Behavior", - "gravityX": 0, - "gravityY": 9.8, - "scaleX": 100, - "scaleY": 100 + "name": "ScreenWrap", + "type": "ScreenWrap::ScreenWrap" } ] }, { "b": 37, "disableInputWhenNotFocused": true, - "mangledName": "Untitled_32scene", - "name": "Untitled scene", + "mangledName": "Separate_32static", + "name": "Separate static", "r": 37, "standardSortMethod": true, "stopSoundsOnStartup": true, @@ -540,21 +489,6 @@ ], "variables": [], "instances": [ - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "RedPlayerShip1", - "persistentUuid": "9ff2bb0e-b2eb-4b93-81af-c0444469469c", - "width": 0, - "x": 485, - "y": 369, - "zOrder": 1, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, { "angle": 0, "customSize": false, @@ -578,8 +512,8 @@ "name": "BigBrownMeteor1", "persistentUuid": "1944b1e4-d9cc-4207-8108-202660699298", "width": 0, - "x": 413, - "y": 149, + "x": 504, + "y": 293, "zOrder": 3, "numberProperties": [], "stringProperties": [], @@ -593,8 +527,8 @@ "name": "BigBrownMeteor1", "persistentUuid": "ef6ae8ec-e101-48dc-83cd-80cd9339c82f", "width": 0, - "x": 691, - "y": 515, + "x": 960, + "y": 138, "zOrder": 4, "numberProperties": [], "stringProperties": [], @@ -608,8 +542,8 @@ "name": "BigBrownMeteor1", "persistentUuid": "29c24acd-7e01-4587-9e78-ec611f1f1f90", "width": 0, - "x": 115, - "y": 524, + "x": 157, + "y": 316, "zOrder": 5, "numberProperties": [], "stringProperties": [], @@ -623,8 +557,8 @@ "name": "BigBrownMeteor1", "persistentUuid": "20553e7b-6091-412f-99e3-744417a7a1f6", "width": 0, - "x": 1073, - "y": 494, + "x": 1040, + "y": 121, "zOrder": 6, "numberProperties": [], "stringProperties": [], @@ -653,8 +587,8 @@ "name": "BigBrownMeteor1", "persistentUuid": "517150aa-0fbf-4512-b563-c6f08042dba6", "width": 0, - "x": 685, - "y": 211, + "x": 570, + "y": 271, "zOrder": 8, "numberProperties": [], "stringProperties": [], @@ -668,8 +602,8 @@ "name": "BigGreyMeteor2", "persistentUuid": "a164943d-79ef-4648-bc7f-58e942730210", "width": 0, - "x": 166, - "y": 111, + "x": 903, + "y": 87, "zOrder": 9, "numberProperties": [], "stringProperties": [], @@ -683,8 +617,8 @@ "name": "BigGreyMeteor2", "persistentUuid": "13e04f7b-6347-4bcd-b6f5-99211f26821d", "width": 0, - "x": 903, - "y": 292, + "x": 642, + "y": 283, "zOrder": 10, "numberProperties": [], "stringProperties": [], @@ -698,8 +632,8 @@ "name": "BigGreyMeteor2", "persistentUuid": "33b31ac4-6bda-4013-b3cb-2749c5414f1b", "width": 0, - "x": 404, - "y": 574, + "x": 550, + "y": 327, "zOrder": 11, "numberProperties": [], "stringProperties": [], @@ -858,41 +792,17 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "CollisionDetector::IsAroundRectangle" + "value": "CollisionDetector::Separate" }, "parameters": [ "", "Obstacle", "Obstacle", - "640", - "0", - "1280", - "720", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "DebuggerTools::ConsoleLog" - }, - "parameters": [ - "\"Brown: \" + ToString(PickedInstancesCount(BigBrownMeteor1))", - "", - "" - ] - }, - { - "type": { - "value": "DebuggerTools::ConsoleLog" - }, - "parameters": [ - "\"Grey: \" + ToString(PickedInstancesCount(BigGreyMeteor2))", - "", + "Obstacle", "" ] } @@ -931,10 +841,2903 @@ "type": "CollisionDetector::Solid" } ] - } - ], - "externalEvents": [], - "eventsFunctionsExtensions": [ + }, + { + "b": 37, + "disableInputWhenNotFocused": true, + "mangledName": "IsAround", + "name": "IsAround", + "r": 37, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 37, + "uiSettings": { + "grid": false, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": false, + "zoomFactor": 0.546875, + "windowMask": false + }, + "objectsGroups": [ + { + "name": "Obstacle", + "objects": [ + { + "name": "BigBrownMeteor1" + }, + { + "name": "BigGreyMeteor2" + } + ] + } + ], + "variables": [], + "instances": [ + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "RedPlayerShip1", + "persistentUuid": "9ff2bb0e-b2eb-4b93-81af-c0444469469c", + "width": 0, + "x": 485, + "y": 369, + "zOrder": 1, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "f9c940ba-9f2e-4b8f-8333-a872187bf521", + "width": 0, + "x": 983, + "y": 85, + "zOrder": 2, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "1944b1e4-d9cc-4207-8108-202660699298", + "width": 0, + "x": 413, + "y": 149, + "zOrder": 3, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "ef6ae8ec-e101-48dc-83cd-80cd9339c82f", + "width": 0, + "x": 691, + "y": 515, + "zOrder": 4, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "29c24acd-7e01-4587-9e78-ec611f1f1f90", + "width": 0, + "x": 115, + "y": 524, + "zOrder": 5, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "20553e7b-6091-412f-99e3-744417a7a1f6", + "width": 0, + "x": 1073, + "y": 494, + "zOrder": 6, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "128cd2f9-0397-44ad-9d5d-7ce7e37276c8", + "width": 0, + "x": 186, + "y": 268, + "zOrder": 7, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "517150aa-0fbf-4512-b563-c6f08042dba6", + "width": 0, + "x": 685, + "y": 211, + "zOrder": 8, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigGreyMeteor2", + "persistentUuid": "a164943d-79ef-4648-bc7f-58e942730210", + "width": 0, + "x": 166, + "y": 111, + "zOrder": 9, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigGreyMeteor2", + "persistentUuid": "13e04f7b-6347-4bcd-b6f5-99211f26821d", + "width": 0, + "x": 903, + "y": 292, + "zOrder": 10, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigGreyMeteor2", + "persistentUuid": "33b31ac4-6bda-4013-b3cb-2749c5414f1b", + "width": 0, + "x": 404, + "y": 574, + "zOrder": 11, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "objects": [ + { + "assetStoreId": "2b2dfbbe01d820384d341ecfa1cf553b2700019a4f78c1d6fc4c55cb4b373bf5", + "name": "RedPlayerShip1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Red playerShip (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "911c6f50a4c05507c6fc1df967493f61a7ce9bad9e144cec92f6ff32be42749a", + "name": "BigBrownMeteor1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Brown Meteor (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "fe9de3e97f21ea1ff6d364d2efe3e7d379cb150152cc2461b10d1ed05f803d09", + "name": "BigGreyMeteor2", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Grey Meteor (2).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DepartScene" + }, + "parameters": [ + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "640", + "0", + "1280", + "720", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "DebuggerTools::ConsoleLog" + }, + "parameters": [ + "\"Brown: \" + ToString(PickedInstancesCount(BigBrownMeteor1))", + "", + "" + ] + }, + { + "type": { + "value": "DebuggerTools::ConsoleLog" + }, + "parameters": [ + "\"Grey: \" + ToString(PickedInstancesCount(BigGreyMeteor2))", + "", + "" + ] + } + ] + } + ] + } + ], + "layers": [ + { + "ambientLightColorB": 0, + "ambientLightColorG": 9943112, + "ambientLightColorR": 16, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "name": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "behaviorsSharedData": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ] + } + ], + "externalEvents": [], + "eventsFunctionsExtensions": [ + { + "author": "Tristan Rhodes (tristan@victrisgames.com), Entropy", + "category": "Movement", + "extensionNamespace": "", + "fullName": "Screen Wrap", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLW1vbml0b3Itc2NyZWVuc2hvdCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik05LDZINVYxMEg3VjhIOU0xOSwxMEgxN1YxMkgxNVYxNEgxOU0yMSwxNkgzVjRIMjFNMjEsMkgzQzEuODksMiAxLDIuODkgMSw0VjE2QTIsMiAwIDAsMCAzLDE4SDEwVjIwSDhWMjJIMTZWMjBIMTRWMThIMjFBMiwyIDAgMCwwIDIzLDE2VjRDMjMsMi44OSAyMi4xLDIgMjEsMiIgLz48L3N2Zz4=", + "name": "ScreenWrap", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/monitor-screenshot.svg", + "shortDescription": "Teleport object when it moves off the screen and immediately appear on the opposite side while maintaining speed and trajectory.", + "version": "0.2.2", + "description": [ + "The teleport happens when the center point of the object crosses a border. ", + "Change behavior properties to increase or decrease the margin used to trigger this teleport.", + "By default, the borders of the wrapping area match the screen size, but they can alo be changed.", + "", + "This behavior can be used to recreate the movement of the classic game \"Asteroids\"." + ], + "origin": { + "identifier": "ScreenWrap", + "name": "gdevelop-extension-store" + }, + "tags": [ + "screen", + "wrap", + "teleport", + "asteroids" + ], + "authorIds": [ + "q8ubdigLvIRXLxsJDDTaokO41mc2", + "gqDaZjCfevOOxBYkK6zlhtZnXCg1" + ], + "dependencies": [], + "eventsFunctions": [], + "eventsBasedBehaviors": [ + { + "description": "Teleport the object when leaving one side of the screen so that it immediately reappears on the opposite side, maintaining speed and trajectory.", + "fullName": "Screen Wrap", + "name": "ScreenWrap", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Initialize variables (if needed)", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::PropertyBorderBottom" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetBottomBorder" + }, + "parameters": [ + "Object", + "Behavior", + "SceneWindowHeight()", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::PropertyBorderRight" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetRightBorder" + }, + "parameters": [ + "Object", + "Behavior", + "SceneWindowWidth()", + "" + ] + } + ] + } + ], + "parameters": [] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPostEvents", + "sentence": "", + "events": [ + { + "colorB": 5, + "colorG": 117, + "colorR": 65, + "creationTime": 0, + "name": "ScreenWrap", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Move object to opposite side (if needed)", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [], + "parameters": [] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::PropertyHorizontalWrapping" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PosX" + }, + "parameters": [ + "Object", + "<", + "Object.Behavior::PropertyBorderLeft() - (Object.Width()/2) - Object.Behavior::PropertyTriggerOffset()" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Object", + "=", + "Object.Behavior::PropertyBorderRight() - (Object.Width()/2) + Object.Behavior::PropertyTriggerOffset()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PosX" + }, + "parameters": [ + "Object", + ">", + "Object.Behavior::PropertyBorderRight() - (Object.Width()/2) + Object.Behavior::PropertyTriggerOffset()" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Object", + "=", + "Object.Behavior::PropertyBorderLeft() - (Object.Width()/2) - Object.Behavior::PropertyTriggerOffset()" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::PropertyVerticalWrapping" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PosY" + }, + "parameters": [ + "Object", + "<", + "Object.Behavior::PropertyBorderTop() - (Object.Height()/2) - Object.Behavior::PropertyTriggerOffset()" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Object", + "=", + "Object.Behavior::PropertyBorderBottom() - (Object.Height()/2) + Object.Behavior::PropertyTriggerOffset()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PosY" + }, + "parameters": [ + "Object", + ">", + "Object.Behavior::PropertyBorderBottom() - (Object.Height()/2) + Object.Behavior::PropertyTriggerOffset()" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Object", + "=", + "Object.Behavior::PropertyBorderTop() - (Object.Height()/2) - Object.Behavior::PropertyTriggerOffset()" + ] + } + ] + } + ] + } + ], + "parameters": [] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the object is wrapping on the left and right borders.", + "fullName": "Is horizontal wrapping", + "functionType": "Condition", + "name": "IsHorizontalWrapping", + "sentence": "_PARAM0_ is horizontal wrapping", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"Horizontal\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"Horizontal\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the object is wrapping on the top and bottom borders.", + "fullName": "Is vertical wrapping", + "functionType": "Condition", + "name": "IsVerticalWrapping", + "sentence": "_PARAM0_ is vertical wrapping", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"Vertical\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"Vertical\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Enable wrapping on the left and right borders.", + "fullName": "Enable horizontal wrapping", + "functionType": "Action", + "name": "EnableHorizontalWrapping", + "sentence": "Enable _PARAM0_ horizontal wrapping: _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"EnableHorizontalWrapping\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyHorizontalWrapping" + }, + "parameters": [ + "Object", + "Behavior", + "no" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"EnableHorizontalWrapping\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyHorizontalWrapping" + }, + "parameters": [ + "Object", + "Behavior", + "yes" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + }, + { + "description": "Value", + "name": "EnableHorizontalWrapping", + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "Enable wrapping on the top and bottom borders.", + "fullName": "Enable vertical wrapping", + "functionType": "Action", + "name": "EnableVerticalWrapping", + "sentence": "Enable _PARAM0_ vertical wrapping: _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"EnableVerticalWrapping\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyVerticalWrapping" + }, + "parameters": [ + "Object", + "Behavior", + "no" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"EnableVerticalWrapping\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyVerticalWrapping" + }, + "parameters": [ + "Object", + "Behavior", + "yes" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + }, + { + "description": "Value", + "name": "EnableVerticalWrapping", + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "Top border (Y position).", + "fullName": "Top border", + "functionType": "Expression", + "name": "BorderTop", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyBorderTop()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Left border (X position).", + "fullName": "Left border", + "functionType": "Expression", + "name": "BorderLeft", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyBorderLeft()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Right border (X position).", + "fullName": "Right border", + "functionType": "Expression", + "name": "BorderRight", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyBorderRight()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Bottom border (Y position).", + "fullName": "Bottom border", + "functionType": "Expression", + "name": "BorderBottom", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyBorderBottom()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Number of pixels past the center where the object teleports and appears.", + "fullName": "Trigger offset", + "functionType": "Expression", + "name": "TriggerOffset", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyTriggerOffset()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Set top border (Y position).", + "fullName": "Set top border", + "functionType": "Action", + "name": "SetTopBorder", + "sentence": "Set _PARAM0_ top border to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyBorderTop" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + }, + { + "description": "Top border value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Set left border (X position).", + "fullName": "Set left border", + "functionType": "Action", + "name": "SetLeftBorder", + "sentence": "Set _PARAM0_ left border to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyBorderLeft" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + }, + { + "description": "Left border value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Set bottom border (Y position).", + "fullName": "Set bottom border", + "functionType": "Action", + "name": "SetBottomBorder", + "sentence": "Set _PARAM0_ bottom border to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyBorderBottom" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + }, + { + "description": "Bottom border value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Set right border (X position).", + "fullName": "Set right border", + "functionType": "Action", + "name": "SetRightBorder", + "sentence": "Set _PARAM0_ right border to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyBorderRight" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + }, + { + "description": "Right border value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Set trigger offset (pixels).", + "fullName": "Set trigger offset", + "functionType": "Action", + "name": "SetTriggerOffset", + "sentence": "Set _PARAM0_ trigger offset to _PARAM2_ pixels", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyTriggerOffset" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + }, + { + "description": "SetScreen Offset Leaving Value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "true", + "type": "Boolean", + "label": "Horizontal wrapping", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "HorizontalWrapping" + }, + { + "value": "true", + "type": "Boolean", + "label": "Vertical wrapping", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "VerticalWrapping" + }, + { + "value": "0", + "type": "Number", + "label": "Top border of wrapped area (Y)", + "description": "If blank, the value will be 0.", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "BorderTop" + }, + { + "value": "0", + "type": "Number", + "label": "Left border of wrapped area (X)", + "description": "If blank, the value will be 0.", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "BorderLeft" + }, + { + "value": "0", + "type": "Number", + "label": "Right border of wrapped area (X)", + "description": "If blank, the value will be the scene width.", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "BorderRight" + }, + { + "value": "0", + "type": "Number", + "label": "Bottom border of wrapped area (Y)", + "description": "If blank, the value will be scene height.", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "BorderBottom" + }, + { + "value": "0", + "type": "Number", + "label": "Number of pixels past the center where the object teleports and appears", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "TriggerOffset" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Teleport the object when leaving one side of the screen so that it immediately reappears on the opposite side, maintaining speed and trajectory.", + "fullName": "Screen Wrap (physics objects)", + "name": "ScreenWrapPhysics", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Initialize variables (if needed)", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::PropertyBorderBottom" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetBottomBorder" + }, + "parameters": [ + "Object", + "Behavior", + "SceneWindowHeight()", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::PropertyBorderRight" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetRightBorder" + }, + "parameters": [ + "Object", + "Behavior", + "SceneWindowWidth()", + "" + ] + } + ] + } + ], + "parameters": [] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "colorB": 5, + "colorG": 117, + "colorR": 65, + "creationTime": 0, + "name": "ScreenWrap", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Move object to opposite side (if needed)", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [], + "parameters": [] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::PropertyHorizontalWrapping" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Velocity is saved because Physics2 resets objects velocities when they are moved from the outside of the extension.", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PosX" + }, + "parameters": [ + "Object", + "<", + "Object.Behavior::PropertyBorderLeft() - (Object.Width()/2) - Object.Behavior::PropertyTriggerOffset()" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrapPhysics::SaveCurrentVelocities" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Object", + "=", + "Object.Behavior::PropertyBorderRight() - (Object.Width()/2) + Object.Behavior::PropertyTriggerOffset()" + ] + }, + { + "type": { + "value": "ScreenWrap::ScreenWrapPhysics::ApplySavedVelocities" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PosX" + }, + "parameters": [ + "Object", + ">", + "Object.Behavior::PropertyBorderRight() - (Object.Width()/2) + Object.Behavior::PropertyTriggerOffset()" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrapPhysics::SaveCurrentVelocities" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Object", + "=", + "Object.Behavior::PropertyBorderLeft() - (Object.Width()/2) - Object.Behavior::PropertyTriggerOffset()" + ] + }, + { + "type": { + "value": "ScreenWrap::ScreenWrapPhysics::ApplySavedVelocities" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::PropertyVerticalWrapping" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PosY" + }, + "parameters": [ + "Object", + "<", + "Object.Behavior::PropertyBorderTop() - (Object.Height()/2) - Object.Behavior::PropertyTriggerOffset()" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrapPhysics::SaveCurrentVelocities" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Object", + "=", + "Object.Behavior::PropertyBorderBottom() - (Object.Height()/2) + Object.Behavior::PropertyTriggerOffset()" + ] + }, + { + "type": { + "value": "ScreenWrap::ScreenWrapPhysics::ApplySavedVelocities" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PosY" + }, + "parameters": [ + "Object", + ">", + "Object.Behavior::PropertyBorderBottom() - (Object.Height()/2) + Object.Behavior::PropertyTriggerOffset()" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrapPhysics::SaveCurrentVelocities" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Object", + "=", + "Object.Behavior::PropertyBorderTop() - (Object.Height()/2) - Object.Behavior::PropertyTriggerOffset()" + ] + }, + { + "type": { + "value": "ScreenWrap::ScreenWrapPhysics::ApplySavedVelocities" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ] + } + ], + "parameters": [] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the object is wrapping on the left and right borders.", + "fullName": "Is horizontal wrapping", + "functionType": "Condition", + "name": "IsHorizontalWrapping", + "sentence": "_PARAM0_ is horizontal wrapping", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"Horizontal\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"Horizontal\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the object is wrapping on the top and bottom borders.", + "fullName": "Is vertical wrapping", + "functionType": "Condition", + "name": "IsVerticalWrapping", + "sentence": "_PARAM0_ is vertical wrapping", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"Vertical\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"Vertical\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Enable wrapping on the left and right borders.", + "fullName": "Enable horizontal wrapping", + "functionType": "Action", + "name": "EnableHorizontalWrapping", + "sentence": "Enable _PARAM0_ horizontal wrapping: _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"EnableHorizontalWrapping\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyHorizontalWrapping" + }, + "parameters": [ + "Object", + "Behavior", + "no" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"EnableHorizontalWrapping\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyHorizontalWrapping" + }, + "parameters": [ + "Object", + "Behavior", + "yes" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + }, + { + "description": "Value", + "name": "EnableHorizontalWrapping", + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "Enable wrapping on the top and bottom borders.", + "fullName": "Enable vertical wrapping", + "functionType": "Action", + "name": "EnableVerticalWrapping", + "sentence": "Enable _PARAM0_ vertical wrapping: _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"EnableVerticalWrapping\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyVerticalWrapping" + }, + "parameters": [ + "Object", + "Behavior", + "no" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"EnableVerticalWrapping\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyVerticalWrapping" + }, + "parameters": [ + "Object", + "Behavior", + "yes" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + }, + { + "description": "Value", + "name": "EnableVerticalWrapping", + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "Top border (Y position).", + "fullName": "Top border", + "functionType": "Expression", + "name": "BorderTop", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyBorderTop()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Left border (X position).", + "fullName": "Left border", + "functionType": "Expression", + "name": "BorderLeft", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyBorderLeft()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Right border (X position).", + "fullName": "Right border", + "functionType": "Expression", + "name": "BorderRight", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyBorderRight()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Bottom border (Y position).", + "fullName": "Bottom border", + "functionType": "Expression", + "name": "BorderBottom", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyBorderBottom()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Number of pixels past the center where the object teleports and appears.", + "fullName": "Trigger offset", + "functionType": "Expression", + "name": "TriggerOffset", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyTriggerOffset()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Set top border (Y position).", + "fullName": "Set top border", + "functionType": "Action", + "name": "SetTopBorder", + "sentence": "Set _PARAM0_ top border to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyBorderTop" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + }, + { + "description": "Top border value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Set left border (X position).", + "fullName": "Set left border", + "functionType": "Action", + "name": "SetLeftBorder", + "sentence": "Set _PARAM0_ left border to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyBorderLeft" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + }, + { + "description": "Left border value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Set bottom border (Y position).", + "fullName": "Set bottom border", + "functionType": "Action", + "name": "SetBottomBorder", + "sentence": "Set _PARAM0_ bottom border to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyBorderBottom" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + }, + { + "description": "Bottom border value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Set right border (X position).", + "fullName": "Set right border", + "functionType": "Action", + "name": "SetRightBorder", + "sentence": "Set _PARAM0_ right border to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyBorderRight" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + }, + { + "description": "Right border value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Set trigger offset (pixels).", + "fullName": "Set trigger offset", + "functionType": "Action", + "name": "SetTriggerOffset", + "sentence": "Set _PARAM0_ trigger offset to _PARAM2_ pixels", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyTriggerOffset" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + }, + { + "description": "SetScreen Offset Leaving Value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Save current velocity values.", + "fullName": "Save current velocity values", + "functionType": "Action", + "name": "SaveCurrentVelocities", + "sentence": "Save current velocity values of _PARAM0_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrapPhysics::SetPropertyAngularVelocity" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.RequiredPhysicsBehavior::AngularVelocity()" + ] + }, + { + "type": { + "value": "ScreenWrap::ScreenWrapPhysics::SetPropertyLinearVelocityX" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.RequiredPhysicsBehavior::LinearVelocityX()" + ] + }, + { + "type": { + "value": "ScreenWrap::ScreenWrapPhysics::SetPropertyLinearVelocityY" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.RequiredPhysicsBehavior::LinearVelocityY()" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Apply saved velocity values.", + "fullName": "Apply saved velocity values", + "functionType": "Action", + "name": "ApplySavedVelocities", + "sentence": "Apply saved velocity values of _PARAM0_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "Physics2::AngularVelocity" + }, + "parameters": [ + "Object", + "RequiredPhysicsBehavior", + "=", + "Object.Behavior::PropertyAngularVelocity()" + ] + }, + { + "type": { + "value": "Physics2::LinearVelocityX" + }, + "parameters": [ + "Object", + "RequiredPhysicsBehavior", + "=", + "Object.Behavior::PropertyLinearVelocityX()" + ] + }, + { + "type": { + "value": "Physics2::LinearVelocityY" + }, + "parameters": [ + "Object", + "RequiredPhysicsBehavior", + "=", + "Object.Behavior::PropertyLinearVelocityY()" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "Physics Behavior", + "description": "", + "group": "", + "extraInformation": [ + "Physics2::Physics2Behavior" + ], + "hidden": false, + "name": "RequiredPhysicsBehavior" + }, + { + "value": "true", + "type": "Boolean", + "label": "Horizontal wrapping", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "HorizontalWrapping" + }, + { + "value": "true", + "type": "Boolean", + "label": "Vertical wrapping", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "VerticalWrapping" + }, + { + "value": "0", + "type": "Number", + "label": "Top border of wrapped area (Y). If blank, the value will be 0.", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "BorderTop" + }, + { + "value": "0", + "type": "Number", + "label": "Left border of wrapped area (X). If blank, the value will be 0.", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "BorderLeft" + }, + { + "value": "0", + "type": "Number", + "label": "Right border of wrapped area (X). If blank, the value will be the scene width.", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "BorderRight" + }, + { + "value": "0", + "type": "Number", + "label": "Bottom border of wrapped area (Y). If blank, the value will be scene height.", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "BorderBottom" + }, + { + "value": "0", + "type": "Number", + "label": "Number of pixels past the center where the object teleports and appears", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "TriggerOffset" + }, + { + "value": "0", + "type": "Number", + "label": "Angular Velocity", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "AngularVelocity" + }, + { + "value": "0", + "type": "Number", + "label": "Linear Velocity X", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "LinearVelocityX" + }, + { + "value": "0", + "type": "Number", + "label": "Linear Velocity Y", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "LinearVelocityY" + } + ], + "sharedPropertyDescriptors": [] + } + ], + "eventsBasedObjects": [] + }, { "author": "", "category": "Movement", @@ -1022,8 +3825,8 @@ " //behavior.currentRBushAABB.updateAABBFromOwner();", " const aabb = behavior.owner.getAABB();", " const fatFactor = behavior._getFatFactor();", - " const marginX = fatFactor * (aabb.min[0] - aabb.max[0]);", - " const marginY = fatFactor * (aabb.min[1] - aabb.max[1]);", + " const marginX = fatFactor * (aabb.max[0] - aabb.min[0]);", + " const marginY = fatFactor * (aabb.max[1] - aabb.min[1]);", " const fatAABB = behavior.currentRBushAABB;", " fatAABB.minX = aabb.min[0] - marginX;", " fatAABB.minY = aabb.min[1] - marginY;", From 9a2c849b05119dfbe82741146a255313bed81275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davy=20H=C3=A9lard?= Date: Wed, 28 Dec 2022 17:58:51 +0100 Subject: [PATCH 07/11] Add a legacy scene. --- examples/rtree/game.json | 332 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 332 insertions(+) diff --git a/examples/rtree/game.json b/examples/rtree/game.json index 38b2f218b..c2f9027fd 100644 --- a/examples/rtree/game.json +++ b/examples/rtree/game.json @@ -451,6 +451,338 @@ } ] }, + { + "b": 37, + "disableInputWhenNotFocused": true, + "mangledName": "Separate_32moving_32_40legacy_41", + "name": "Separate moving (legacy)", + "r": 37, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 37, + "uiSettings": { + "grid": false, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": false, + "zoomFactor": 0.546875, + "windowMask": false + }, + "objectsGroups": [ + { + "name": "Obstacle", + "objects": [ + { + "name": "BigBrownMeteor1" + }, + { + "name": "BigGreyMeteor2" + } + ] + } + ], + "variables": [], + "instances": [], + "objects": [ + { + "assetStoreId": "2b2dfbbe01d820384d341ecfa1cf553b2700019a4f78c1d6fc4c55cb4b373bf5", + "name": "RedPlayerShip1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Red playerShip (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "911c6f50a4c05507c6fc1df967493f61a7ce9bad9e144cec92f6ff32be42749a", + "name": "BigBrownMeteor1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "ScreenWrap", + "type": "ScreenWrap::ScreenWrap", + "HorizontalWrapping": true, + "VerticalWrapping": true, + "BorderTop": 0, + "BorderLeft": 0, + "BorderRight": 0, + "BorderBottom": 0, + "TriggerOffset": 0 + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Brown Meteor (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "fe9de3e97f21ea1ff6d364d2efe3e7d379cb150152cc2461b10d1ed05f803d09", + "name": "BigGreyMeteor2", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "ScreenWrap", + "type": "ScreenWrap::ScreenWrap", + "HorizontalWrapping": true, + "VerticalWrapping": true, + "BorderTop": 0, + "BorderLeft": 0, + "BorderRight": 0, + "BorderBottom": 0, + "TriggerOffset": 0 + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Grey Meteor (2).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DepartScene" + }, + "parameters": [ + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "256", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "BigBrownMeteor1", + "RandomInRange(0, 1280)", + "RandomInRange(0, 720)", + "" + ] + }, + { + "type": { + "value": "AddForceAL" + }, + "parameters": [ + "BigBrownMeteor1", + "Random(360)", + "100", + "1" + ] + }, + { + "type": { + "value": "ChangeScale" + }, + "parameters": [ + "BigBrownMeteor1", + "=", + "0.25" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "128", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "BigGreyMeteor2", + "RandomInRange(0, 1280)", + "RandomInRange(0, 720)", + "" + ] + }, + { + "type": { + "value": "AddForceAL" + }, + "parameters": [ + "BigGreyMeteor2", + "Random(360)", + "100", + "1" + ] + }, + { + "type": { + "value": "ChangeScale" + }, + "parameters": [ + "BigGreyMeteor2", + "=", + "0.25" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SeparateFromObjects" + }, + "parameters": [ + "Obstacle", + "Obstacle", + "" + ] + } + ] + } + ], + "layers": [ + { + "ambientLightColorB": 0, + "ambientLightColorG": 9943112, + "ambientLightColorR": 16, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "name": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "behaviorsSharedData": [ + { + "name": "ScreenWrap", + "type": "ScreenWrap::ScreenWrap" + } + ] + }, { "b": 37, "disableInputWhenNotFocused": true, From df246c415e7017575a1144d71a80f4b5c5998f7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davy=20H=C3=A9lard?= Date: Wed, 28 Dec 2022 23:04:15 +0100 Subject: [PATCH 08/11] Use a R-Tree screen wrapping. --- examples/rtree/game.json | 350 +++++++++++++++++++++++++++++---------- 1 file changed, 260 insertions(+), 90 deletions(-) diff --git a/examples/rtree/game.json b/examples/rtree/game.json index c2f9027fd..834991b61 100644 --- a/examples/rtree/game.json +++ b/examples/rtree/game.json @@ -196,17 +196,6 @@ "name": "Obstacle", "type": "CollisionDetector::Solid", "SolidType": "Mobile" - }, - { - "name": "ScreenWrap", - "type": "ScreenWrap::ScreenWrap", - "HorizontalWrapping": true, - "VerticalWrapping": true, - "BorderTop": 0, - "BorderLeft": 0, - "BorderRight": 0, - "BorderBottom": 0, - "TriggerOffset": 0 } ], "animations": [ @@ -254,17 +243,6 @@ "name": "Obstacle", "type": "CollisionDetector::Solid", "SolidType": "Mobile" - }, - { - "name": "ScreenWrap", - "type": "ScreenWrap::ScreenWrap", - "HorizontalWrapping": true, - "VerticalWrapping": true, - "BorderTop": 0, - "BorderLeft": 0, - "BorderRight": 0, - "BorderBottom": 0, - "TriggerOffset": 0 } ], "animations": [ @@ -317,7 +295,7 @@ "events": [ { "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "256", + "repeatExpression": "512", "conditions": [], "actions": [ { @@ -331,31 +309,11 @@ "RandomInRange(0, 720)", "" ] - }, - { - "type": { - "value": "AddForceAL" - }, - "parameters": [ - "BigBrownMeteor1", - "Random(360)", - "100", - "1" - ] - }, - { - "type": { - "value": "ChangeScale" - }, - "parameters": [ - "BigBrownMeteor1", - "=", - "0.25" - ] } ] }, { + "disabled": true, "type": "BuiltinCommonInstructions::Repeat", "repeatExpression": "128", "conditions": [], @@ -371,26 +329,32 @@ "RandomInRange(0, 720)", "" ] - }, + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { "type": { - "value": "AddForceAL" + "value": "ChangeScale" }, "parameters": [ - "BigGreyMeteor2", - "Random(360)", - "100", - "1" + "Obstacle", + "=", + "0.25" ] }, { "type": { - "value": "ChangeScale" + "value": "AddForceAL" }, "parameters": [ - "BigGreyMeteor2", - "=", - "0.25" + "Obstacle", + "Random(360)", + "100", + "1" ] } ] @@ -414,6 +378,195 @@ ] } ] + }, + { + "disabled": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "MouseX()", + "MouseY()", + "MouseX()", + "MouseY()", + "" + ] + }, + { + "type": { + "value": "SourisSurObjet" + }, + "parameters": [ + "Obstacle", + "", + "", + "" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "ChangeColor" + }, + "parameters": [ + "Obstacle", + "ToString(Random(255)) + \";\" + ToString(Random(255)) + \";\" + ToString(Random(255))" + ] + } + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Screen wrap", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "-128", + "-128", + "1280 + 128", + "-64", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Obstacle", + "=", + "720" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "-128", + "720 + 64", + "1280 + 128", + "720 + 128", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Obstacle", + "=", + "-32" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "-128", + "-128", + "-64", + "720 + 128", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Obstacle", + "=", + "1280" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "1280 + 64", + "-128", + "1280 + 128", + "720 + 128", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Obstacle", + "=", + "-32" + ] + } + ] + } + ], + "parameters": [] } ], "layers": [ @@ -444,10 +597,6 @@ { "name": "Obstacle", "type": "CollisionDetector::Solid" - }, - { - "name": "ScreenWrap", - "type": "ScreenWrap::ScreenWrap" } ] }, @@ -655,7 +804,7 @@ "events": [ { "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "256", + "repeatExpression": "512", "conditions": [], "actions": [ { @@ -669,31 +818,11 @@ "RandomInRange(0, 720)", "" ] - }, - { - "type": { - "value": "AddForceAL" - }, - "parameters": [ - "BigBrownMeteor1", - "Random(360)", - "100", - "1" - ] - }, - { - "type": { - "value": "ChangeScale" - }, - "parameters": [ - "BigBrownMeteor1", - "=", - "0.25" - ] } ] }, { + "disabled": true, "type": "BuiltinCommonInstructions::Repeat", "repeatExpression": "128", "conditions": [], @@ -709,26 +838,32 @@ "RandomInRange(0, 720)", "" ] - }, + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { "type": { - "value": "AddForceAL" + "value": "ChangeScale" }, "parameters": [ - "BigGreyMeteor2", - "Random(360)", - "100", - "1" + "Obstacle", + "=", + "0.25" ] }, { "type": { - "value": "ChangeScale" + "value": "AddForceAL" }, "parameters": [ - "BigGreyMeteor2", - "=", - "0.25" + "Obstacle", + "Random(360)", + "100", + "1" ] } ] @@ -750,6 +885,40 @@ ] } ] + }, + { + "disabled": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SourisSurObjet" + }, + "parameters": [ + "Obstacle", + "", + "", + "" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "ChangeColor" + }, + "parameters": [ + "Obstacle", + "ToString(Random(255)) + \";\" + ToString(Random(255)) + \";\" + ToString(Random(255))" + ] + } + ] } ], "layers": [ @@ -4366,6 +4535,7 @@ "const objects = eventsFunctionContext.getObjects(\"Object\");\r", "const solidObjectLists = eventsFunctionContext.getObjectsLists(\"SolidObject\");\r", "\r", + "// TODO avoid allocation\r", "const nearObjects = []\r", "for (const object of objects) {\r", " const left = object.getAABBLeft();\r", From d3af3ad61de82da1c708dcdbbf1d2d60caaa2e12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davy=20H=C3=A9lard?= Date: Fri, 30 Dec 2022 22:10:34 +0100 Subject: [PATCH 09/11] Clean up the examples. --- examples/rtree/game.json | 1269 ++++++++++++++++++++++++++++++-------- 1 file changed, 1024 insertions(+), 245 deletions(-) diff --git a/examples/rtree/game.json b/examples/rtree/game.json index 834991b61..9af8f0181 100644 --- a/examples/rtree/game.json +++ b/examples/rtree/game.json @@ -106,8 +106,8 @@ { "b": 37, "disableInputWhenNotFocused": true, - "mangledName": "Separate_32moving", - "name": "Separate moving", + "mangledName": "Screen_32warpping", + "name": "Screen warpping", "r": 37, "standardSortMethod": true, "stopSoundsOnStartup": true, @@ -240,9 +240,949 @@ "effects": [], "behaviors": [ { - "name": "Obstacle", - "type": "CollisionDetector::Solid", - "SolidType": "Mobile" + "name": "Obstacle", + "type": "CollisionDetector::Solid", + "SolidType": "Mobile" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Grey Meteor (2).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DepartScene" + }, + "parameters": [ + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "512", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "BigBrownMeteor1", + "RandomInRange(0, 1280)", + "RandomInRange(0, 720)", + "" + ] + } + ] + }, + { + "disabled": true, + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "128", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "BigGreyMeteor2", + "RandomInRange(0, 1280)", + "RandomInRange(0, 720)", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ChangeScale" + }, + "parameters": [ + "Obstacle", + "=", + "0.25" + ] + }, + { + "type": { + "value": "AddForceAL" + }, + "parameters": [ + "Obstacle", + "Random(360)", + "100", + "1" + ] + } + ] + } + ] + }, + { + "disabled": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "MouseX()", + "MouseY()", + "MouseX()", + "MouseY()", + "" + ] + }, + { + "type": { + "value": "SourisSurObjet" + }, + "parameters": [ + "Obstacle", + "", + "", + "" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "ChangeColor" + }, + "parameters": [ + "Obstacle", + "ToString(Random(255)) + \";\" + ToString(Random(255)) + \";\" + ToString(Random(255))" + ] + } + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Screen wrap", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "-128", + "-128", + "1280 + 128", + "-64", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Obstacle", + "=", + "720" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "-128", + "720 + 64", + "1280 + 128", + "720 + 128", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Obstacle", + "=", + "-32" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "-128", + "-128", + "-64", + "720 + 128", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Obstacle", + "=", + "1280" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "1280 + 64", + "-128", + "1280 + 128", + "720 + 128", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Obstacle", + "=", + "-32" + ] + } + ] + } + ], + "parameters": [] + } + ], + "layers": [ + { + "ambientLightColorB": 0, + "ambientLightColorG": 9943112, + "ambientLightColorR": 16, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "name": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "behaviorsSharedData": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ] + }, + { + "b": 37, + "disableInputWhenNotFocused": true, + "mangledName": "Separate_32moving", + "name": "Separate moving", + "r": 37, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 37, + "uiSettings": { + "grid": false, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": false, + "zoomFactor": 0.546875, + "windowMask": false + }, + "objectsGroups": [ + { + "name": "Obstacle", + "objects": [ + { + "name": "BigBrownMeteor1" + }, + { + "name": "BigGreyMeteor2" + } + ] + } + ], + "variables": [], + "instances": [], + "objects": [ + { + "assetStoreId": "2b2dfbbe01d820384d341ecfa1cf553b2700019a4f78c1d6fc4c55cb4b373bf5", + "name": "RedPlayerShip1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Red playerShip (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "911c6f50a4c05507c6fc1df967493f61a7ce9bad9e144cec92f6ff32be42749a", + "name": "BigBrownMeteor1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid", + "SolidType": "Mobile" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Brown Meteor (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "fe9de3e97f21ea1ff6d364d2efe3e7d379cb150152cc2461b10d1ed05f803d09", + "name": "BigGreyMeteor2", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid", + "SolidType": "Mobile" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Grey Meteor (2).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DepartScene" + }, + "parameters": [ + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "512", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "BigBrownMeteor1", + "RandomInRange(0, 1280)", + "RandomInRange(0, 720)", + "" + ] + } + ] + }, + { + "disabled": true, + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "128", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "BigGreyMeteor2", + "RandomInRange(0, 1280)", + "RandomInRange(0, 720)", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ChangeScale" + }, + "parameters": [ + "Obstacle", + "=", + "0.25" + ] + }, + { + "type": { + "value": "AddForceAL" + }, + "parameters": [ + "Obstacle", + "Random(360)", + "100", + "1" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CollisionDetector::Separate" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "Obstacle", + "Obstacle", + "" + ] + } + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Screen wrap", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "-128", + "-128", + "1280 + 128", + "-64", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Obstacle", + "=", + "720" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "-128", + "720 + 64", + "1280 + 128", + "720 + 128", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Obstacle", + "=", + "-32" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "-128", + "-128", + "-64", + "720 + 128", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Obstacle", + "=", + "1280" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "1280 + 64", + "-128", + "1280 + 128", + "720 + 128", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Obstacle", + "=", + "-32" + ] + } + ] + } + ], + "parameters": [] + } + ], + "layers": [ + { + "ambientLightColorB": 0, + "ambientLightColorG": 9943112, + "ambientLightColorR": 16, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "name": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "behaviorsSharedData": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ] + }, + { + "b": 37, + "disableInputWhenNotFocused": true, + "mangledName": "Screen_32warpping_32_40legacy_41", + "name": "Screen warpping (legacy)", + "r": 37, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 37, + "uiSettings": { + "grid": false, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": false, + "zoomFactor": 0.546875, + "windowMask": false + }, + "objectsGroups": [ + { + "name": "Obstacle", + "objects": [ + { + "name": "BigBrownMeteor1" + }, + { + "name": "BigGreyMeteor2" + } + ] + } + ], + "variables": [], + "instances": [], + "objects": [ + { + "assetStoreId": "2b2dfbbe01d820384d341ecfa1cf553b2700019a4f78c1d6fc4c55cb4b373bf5", + "name": "RedPlayerShip1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Red playerShip (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "911c6f50a4c05507c6fc1df967493f61a7ce9bad9e144cec92f6ff32be42749a", + "name": "BigBrownMeteor1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "ScreenWrap", + "type": "ScreenWrap::ScreenWrap", + "HorizontalWrapping": true, + "VerticalWrapping": true, + "BorderTop": 0, + "BorderLeft": 0, + "BorderRight": 0, + "BorderBottom": 0, + "TriggerOffset": 0 + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Brown Meteor (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "fe9de3e97f21ea1ff6d364d2efe3e7d379cb150152cc2461b10d1ed05f803d09", + "name": "BigGreyMeteor2", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "ScreenWrap", + "type": "ScreenWrap::ScreenWrap", + "HorizontalWrapping": true, + "VerticalWrapping": true, + "BorderTop": 0, + "BorderLeft": 0, + "BorderRight": 0, + "BorderBottom": 0, + "TriggerOffset": 0 } ], "animations": [ @@ -361,43 +1301,10 @@ } ] }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "CollisionDetector::Separate" - }, - "parameters": [ - "", - "Obstacle", - "Obstacle", - "Obstacle", - "" - ] - } - ] - }, { "disabled": true, "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "CollisionDetector::IsAroundRectangle" - }, - "parameters": [ - "", - "Obstacle", - "Obstacle", - "MouseX()", - "MouseY()", - "MouseX()", - "MouseY()", - "" - ] - }, { "type": { "value": "SourisSurObjet" @@ -427,146 +1334,6 @@ ] } ] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Screen wrap", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "CollisionDetector::IsAroundRectangle" - }, - "parameters": [ - "", - "Obstacle", - "Obstacle", - "-128", - "-128", - "1280 + 128", - "-64", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "MettreY" - }, - "parameters": [ - "Obstacle", - "=", - "720" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "CollisionDetector::IsAroundRectangle" - }, - "parameters": [ - "", - "Obstacle", - "Obstacle", - "-128", - "720 + 64", - "1280 + 128", - "720 + 128", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "MettreY" - }, - "parameters": [ - "Obstacle", - "=", - "-32" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "CollisionDetector::IsAroundRectangle" - }, - "parameters": [ - "", - "Obstacle", - "Obstacle", - "-128", - "-128", - "-64", - "720 + 128", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "MettreX" - }, - "parameters": [ - "Obstacle", - "=", - "1280" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "CollisionDetector::IsAroundRectangle" - }, - "parameters": [ - "", - "Obstacle", - "Obstacle", - "1280 + 64", - "-128", - "1280 + 128", - "720 + 128", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "MettreX" - }, - "parameters": [ - "Obstacle", - "=", - "-32" - ] - } - ] - } - ], - "parameters": [] } ], "layers": [ @@ -595,8 +1362,8 @@ ], "behaviorsSharedData": [ { - "name": "Obstacle", - "type": "CollisionDetector::Solid" + "name": "ScreenWrap", + "type": "ScreenWrap::ScreenWrap" } ] }, @@ -885,40 +1652,6 @@ ] } ] - }, - { - "disabled": true, - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SourisSurObjet" - }, - "parameters": [ - "Obstacle", - "", - "", - "" - ] - }, - { - "type": { - "value": "BuiltinCommonInstructions::Once" - }, - "parameters": [] - } - ], - "actions": [ - { - "type": { - "value": "ChangeColor" - }, - "parameters": [ - "Obstacle", - "ToString(Random(255)) + \";\" + ToString(Random(255)) + \";\" + ToString(Random(255))" - ] - } - ] } ], "layers": [ @@ -955,8 +1688,8 @@ { "b": 37, "disableInputWhenNotFocused": true, - "mangledName": "Separate_32static", - "name": "Separate static", + "mangledName": "Test_32separate", + "name": "Test separate", "r": 37, "standardSortMethod": true, "stopSoundsOnStartup": true, @@ -1302,9 +2035,9 @@ "parameters": [ "", "Obstacle", + "", "Obstacle", - "Obstacle", - "" + "Obstacle" ] } ] @@ -1346,8 +2079,8 @@ { "b": 37, "disableInputWhenNotFocused": true, - "mangledName": "IsAround", - "name": "IsAround", + "mangledName": "Test_32IsAround", + "name": "Test IsAround", "r": 37, "standardSortMethod": true, "stopSoundsOnStartup": true, @@ -4308,8 +5041,10 @@ "const SolidManager = /** @class */ (function () {", " /**", " * Create a manager.", + " * @param {string} behaviorName", " */", - " function SolidManager() {", + " function SolidManager(behaviorName) {", + " this.behaviorName = behaviorName;", " this.rBushes = new Map();", " }", "", @@ -4318,6 +5053,11 @@ " * @param {gdjs.RuntimeBehavior} behavior", " */", " SolidManager.prototype.add = function (behavior) {", + " const rBush = this.rBushes.get(behavior.owner.getName());", + " if (!rBush) {", + " return;", + " }", + "", " if (!behavior.currentRBushAABB) {", " behavior.currentRBushAABB = new gdjs.BehaviorRBushAABB(", " behavior", @@ -4334,7 +5074,6 @@ " fatAABB.maxX = aabb.max[0] + marginX;", " fatAABB.maxY = aabb.max[1] + marginY;", " ", - " const rBush = this.getRBush(behavior.owner.getName());", " rBush.insert(fatAABB);", " }", "", @@ -4343,7 +5082,11 @@ " * @param {gdjs.RuntimeBehavior} behavior", " */", " SolidManager.prototype.remove = function (behavior) {", - " const rBush = this.getRBush(behavior.owner.getName());", + " const rBush = this.rBushes.get(behavior.owner.getName());", + " if (!rBush) {", + " return;", + " }", + " ", " rBush.remove(behavior.currentRBushAABB);", " }", " ", @@ -4352,27 +5095,38 @@ " * @param {gdjs.RuntimeBehavior} behavior", " */", " SolidManager.prototype.update = function (behavior) {", + " const rBush = this.rBushes.get(behavior.owner.getName());", + " if (!rBush) {", + " return;", + " }", + "", " const fatAABB = behavior.currentRBushAABB;", " const aabb = behavior.owner.getAABB();", "", " if (!includesAABB(fatAABB, aabb)) {", - " const rBush = this.getRBush(behavior.owner.getName());", " this.remove(behavior);", " this.add(behavior);", " }", " }", "", - " SolidManager.prototype.getRBush = function (objectName) {", + " /**", + " * @param {gdjs.RuntimeInstanceContainer} runtimeScene", + " * @param {string} objectName", + " */", + " SolidManager.prototype.getOrCreateRBush = function (runtimeScene, objectName) {", " let rBush = this.rBushes.get(objectName);", " if (!rBush) {", " rBush = new rbush();", " this.rBushes.set(objectName, rBush);", + " const objects = runtimeScene.getObjects(objectName);", + " objects.forEach(object => this.add(object.getBehavior(this.behaviorName)));", " }", " return rBush;", " }", "", " /**", " * Returns all the instances around the specified area.", + " * @param {gdjs.RuntimeInstanceContainer} runtimeScene", " * @param {string} objectName", " * @param {number} left", " * @param {number} top", @@ -4381,7 +5135,7 @@ " * @param {gdjs.RuntimeObject[]} results", " * @return {gdjs.RuntimeObject[]} An array with all boids near the object.", " */", - " SolidManager.prototype.getAllInstancesInRectangle = function (objectName, left, top, right, bottom, results) {", + " SolidManager.prototype.getAllInstancesInRectangle = function (runtimeScene, objectName, left, top, right, bottom, results) {", " const searchArea = gdjs.staticObject(", " SolidManager.prototype.getAllInstancesInRectangle", " );", @@ -4389,7 +5143,7 @@ " searchArea.minY = top;", " searchArea.maxX = right;", " searchArea.maxY = bottom;", - " const rBush = this.getRBush(objectName);", + " const rBush = this.getOrCreateRBush(runtimeScene, objectName);", " // TODO The R-Tree should not allocate an array.", " const nearbys = rBush.search(searchArea);", " results.length = 0;", @@ -4459,7 +5213,7 @@ "for (const solidObjectName in solidObjectsLists.items) {\r", " const pickedObjects = solidObjectsLists.items[solidObjectName];\r", " if (pickedObjects.length === runtimeScene.getInstancesCountOnScene(solidObjectName)) {\r", - " manager.getAllInstancesInRectangle(solidObjectName, left, top, right, bottom, pickedObjects);\r", + " manager.getAllInstancesInRectangle(runtimeScene, solidObjectName, left, top, right, bottom, pickedObjects);\r", " }\r", " else {\r", " // TODO avoid alloction\r", @@ -4521,7 +5275,7 @@ "fullName": "Separate objects", "functionType": "Action", "name": "Separate", - "sentence": "Move _PARAM1_ away from _PARAM2_ (only _PARAM1_ move)", + "sentence": "Move _PARAM1_ away from _PARAM3_ (only _PARAM1_ move)", "events": [ { "type": "BuiltinCommonInstructions::JsCode", @@ -4533,24 +5287,41 @@ "const manager = runtimeScene.__collisionDetectorExtension.solidManager;\r", "\r", "const objects = eventsFunctionContext.getObjects(\"Object\");\r", - "const solidObjectLists = eventsFunctionContext.getObjectsLists(\"SolidObject\");\r", + "const otherObjects = eventsFunctionContext.getObjects(\"OtherObject\");\r", + "\r", + "const iteratedObjects = objects;\r", + "const searchedObjectLists = eventsFunctionContext.getObjectsLists(\"OtherObject\");\r", + "\r", + "// It's not possible because of separateFromObjects\r", + "\r", + "// // Iterate on the smaller array\r", + "// let iteratedObjects;\r", + "// let searchedObjectLists;\r", + "// if (objects.length <= otherObjects.length) {\r", + "// iteratedObjects = objects;\r", + "// searchedObjectLists = eventsFunctionContext.getObjectsLists(\"OtherObject\");\r", + "// }\r", + "// else {\r", + "// iteratedObjects = otherObjects;\r", + "// searchedObjectLists = eventsFunctionContext.getObjectsLists(\"Object\");\r", + "// }\r", "\r", "// TODO avoid allocation\r", "const nearObjects = []\r", - "for (const object of objects) {\r", - " const left = object.getAABBLeft();\r", - " const top = object.getAABBTop();\r", - " const right = object.getAABBRight();\r", - " const bottom = object.getAABBBottom();\r", - " for (const solidObjectName in solidObjectLists.items) {\r", - " const pickedObjects = solidObjectLists.items[solidObjectName];\r", - " if (pickedObjects.length === runtimeScene.getInstancesCountOnScene(solidObjectName)) {\r", + "for (const iteratedObject of iteratedObjects) {\r", + " const left = iteratedObject.getAABBLeft();\r", + " const top = iteratedObject.getAABBTop();\r", + " const right = iteratedObject.getAABBRight();\r", + " const bottom = iteratedObject.getAABBBottom();\r", + " for (const searchedObjectName in searchedObjectLists.items) {\r", + " const pickedObjects = searchedObjectLists.items[searchedObjectName];\r", + " if (pickedObjects.length === runtimeScene.getInstancesCountOnScene(searchedObjectName)) {\r", " nearObjects.length = 0;\r", - " manager.getAllInstancesInRectangle(solidObjectName, left, top, right, bottom, nearObjects);\r", - " object.separateFromObjects(nearObjects);\r", + " manager.getAllInstancesInRectangle(runtimeScene, searchedObjectName, left, top, right, bottom, nearObjects);\r", + " iteratedObject.separateFromObjects(nearObjects);\r", " }\r", " else {\r", - " // Avoid to do intersection between pickedObjects and nearObjects\r", + " // It avoids to do intersection between pickedObjects and nearObjects\r", " // as it is O(n²) and the naive collision is O(n).\r", " object.separateFromObjects(pickedObjects);\r", " }\r", @@ -4568,14 +5339,20 @@ "name": "Object", "type": "objectList" }, + { + "description": "Solid behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + }, { "description": "Object (won't move)", - "name": "SolidObject", + "name": "OtherObject", "type": "objectList" }, { - "description": "Behavior", - "name": "Behavior", + "description": "Solid behavior", + "name": "OtherBehavior", "supplementaryInformation": "CollisionDetector::Solid", "type": "behavior" } @@ -4614,9 +5391,11 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "", "runtimeScene.__collisionDetectorExtension = runtimeScene.__collisionDetectorExtension || {};", "runtimeScene.__collisionDetectorExtension.solidManager =", - " runtimeScene.__collisionDetectorExtension.solidManager || new gdjs.__collisionDetectorExtension.SolidManager();" + " runtimeScene.__collisionDetectorExtension.solidManager || new gdjs.__collisionDetectorExtension.SolidManager(behaviorName);" ], "parameterObjects": "", "useStrict": true, From e194a5b3bf6ae328b4609e9d00b1af41029f1abd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davy=20H=C3=A9lard?= Date: Sat, 31 Dec 2022 23:58:16 +0100 Subject: [PATCH 10/11] Add an example for screen filter. --- examples/rtree/assets/Green Ufo.png | Bin 0 -> 3049 bytes .../rtree/assets/tiled_dark purple space.png | Bin 0 -> 2880 bytes examples/rtree/game.json | 7195 ++++++++++++++--- 3 files changed, 6249 insertions(+), 946 deletions(-) create mode 100644 examples/rtree/assets/Green Ufo.png create mode 100644 examples/rtree/assets/tiled_dark purple space.png diff --git a/examples/rtree/assets/Green Ufo.png b/examples/rtree/assets/Green Ufo.png new file mode 100644 index 0000000000000000000000000000000000000000..7d441b2c5ff5f42d6ea61ad9503fb3f237f925f4 GIT binary patch literal 3049 zcmV{;dRAdqv8pHvVNu$rl`yIRLx~qGiz4mnPEz)F#q351^_IK9)_8Rx@=xDQ_r5iS% zyR3U)`ih=`#~{ml2Kux@pLuO#{}s4T$Jw989{@w3uGmyN^?L7@MJmDl=q2EL{)r0fjq*&E9GFJg#csQfg?%4 zbqQV~W`G19vkOW9Wf&>Qhx_t9{&z#d0Sa7c>Azrxn%)MAjhKF^6i|0?zzIjW|WrUE|V2@d;AWekYGhWzmJZ!HCzzkCRQ z*EmHC@O4e)XxPqL&V)Ae!F~VJv6g~8eC$NS^Bg_(huRBm8iy0mc*8z1jDtsymji@o4XyqI2DOR$2JT`Ncz9FSg1vL-UKZ-@j9AIkY3ob8^6w2eS|lrkm%m zI#zFAZGO0WS}@2d zz$SU=yT!$};R8wHUJJyu8x8}QGQ)A)l`u6@H@E7%7QaVv7f>yv!wOCSe*0v}jR*fkG zsft?zXc~wXa4eqS_UIgAec{9R!`#yVP0xpyTm?9^m&R@~gLw$pxmevyLHgt-Sb+drpxETv%qRHF7hnC4N#-Bn{&0T7K4Lrx()-h4bBAk z6Q3@y4i575o`c2ukNb-kUU=Oq_&u((-2*TGiEn0&d7gXwF0jrp(=*9(3|E4qlDjE% zYU65|y@1OquYvulnX(XgkT!r{er0trf6jx&luKu*<-P@r%g@=g9DMEqy6V|@ezM9+ zBUc`HI^FWBx()yi4L9*MB5zubG;uRPe(K4k#m$rFdVwqjpNGbqo*&BK0-6L7NA1{U zT}q|hO$%d;TdrM@FktyvP{Hjt-V+6~6x^?;e=yh_U9@3hxDz+R0LCzEY{nWvo=~8d zEPgI2$Wm6mH8vK4wL$}UsC7hPSS*xQ3JG;$G+K>CO2#9=u{nVz!OW3y8fdOYyQ>y( zO+isZM38Fop!y*|!@LTKLtu)>^0Q5*UNO7==gbBkmy`ld&Z*s_RKn{{DBTt6F>170 z#*(oZrUiOtaqBgA7PF@;9FW++HBm{MPoU-P(gcK;L$Q#MsbccXBvme@zrj4l_B^5*HLeh zTy$HU!zI3^9?Y=Ri=i*r5V=@tGDtCT?lLe%6{sPLqsC*D`95D4TqD!2oZ|$WFO(+k z22J>Sl-`SE4A>gJ=GT9|ZC5rsdgirvS%JRox&;kpAbFR*W?)EUlA?em*pw&;$uqjV zM(}xV3gL^S32^)$UmUsM<#Q(|$07+_M?J|HvyVs7OoHF@>k%Bv>nYAGO~4tG=a+)N zOO3AbDqRU_q~xN^zbdd%ZF=~(lVz=*=|;%^`8YDEZR=Q(kwI5gmI-VZMk=sTe8{U$ zO?B1(cd#`WslY~MCoijo$QvQcjj{rppxSgif$bU(e(#HsnnqAgTU9Xb(geAnv^&_Y znTp^0Vx$HeZw`Ef;&D?e#96T27&U+$V`sY}W|HIbTO)BX?vTWXmo*Xtw#)01@r0aq zc8G908%Yh{FtMjoGZY0jg6cl;gq$8^NPf~c^bk^_*5E->S#U_ASL5Q!ctYx=Zm1yd z>6=5v3kfZlFFVX)qkb;15i4#*&e0_@>gNg-%Q#P9)bHOqY+DtSOI)EzxWKvN*}fv< z*~pD*dUHbX`LB1f*4dD$3E6Z-6PlC>(^gw0(h6}^aX}E_4B13xOolzC!vIyEAqmq~ zaku1ZO%4?j(&k4IztJ2d&#s$l_cWrZzmTzDaAqqk5Sd+fMJ`RD;;8I8m7ayxjQ~hZ zfxFC5H`DGm)r}yFl(Q>=>P8xBwY5c+Rb613<|I?n6#SVZRmKJPmq3FSG#v`2GK^rp zmPPQPjis7}5&{?BRK1!Da8qFpyhV+v7o*kGK{lq=kM}%=Qi-;9t_pA@VN(K)`^5kq z%GK7=GgIHAwmw@H^=RC82jA7xLC z$;Gdt6AmlNF3ZYXb$s%KagKs|<-7TioZt4ZB+T;b=qy<_|-`GuA0J6{a8uWawUUuFG zY4Wzc`XDvh?Hlj*0a|Lh&u%!NFT7xF`-YSUKf5e?(*W`q)g8VX?e-B<18PV!KkrpX zmYeso$L{uE>wC=JyDt0JL*v}30q26Uf>b*^qySp%%Fx&H{YC(|wso&rU}ILK0GjV= z8GN<^_=z03cB}-wz`k|??*bbD z(@s1&o|A9DmF4&qzUi&+7NMwtqrFd27pLv7gj0hBmD|`RI~#%p4^EV(UlFCgKOH|6 zzZYxH9pfe7T1w%Sp6#%uGhVpwmd=tonzB>8JmWwExU6ArHQ4A9@ZHjx!lo@b1A%k6 z3vjMUn7-|{Gdwmg*8-hvliL`;VHV~*@S#;FHSw*AS_ZTUa2WVGkFv^nD3B?X%;VQB z2bv#m#e?d(&Z)_LD3HmtgTvBxXGy}-W?eRCCD%D){E$r~N^>1emHN~?%+7Il5-Oc++OFq8Vu3ZC2iY;6f9RxB zd0sCDn`Z)9b1s0M%T00000NkvXXu0mjfi}=xznzJN$Zh?qx{kt7tG5d>e0 zv`Psgg8f-Qw*@TajhYAwtw^C8D@q6;il73DVR=J#f?&7(Ej$0*d+wa`opaCqzB_Yb zTY#^H*=jQYfQ8>??;rp$=oAA?vFM<&Vv^9o8r~EN2MhPZQjQn`o?PKR2-j)l@=-F6F5d6f{ZUhqXD2ZWg<>w3sWv$G@W;V6*{ zV2;dDAo*|(!5fl9ig_ZKClug}h@5@GLofr6R{CZOe9>E2fn>H#Xv2syj)+JiI2pGz z=jiYM|6Td~x84#s2>PSm{|PJ!k&7T=5F`;E5=Wv3xBo+9DiMt>hB&ZL93m7Roa^GY zXdx_=L<>bYHXHZx4xWH3luFjmxcmFl`~(u1BZ!3jycu{DfWYH%X%uI)F`KCFRI0ZV ziL{AK^>p@Ov&oyh+$dysCs&ubSZ`tEAwDF4=VG~k#CpyfYh(gngl6`J#JpID>mwHO zaWgxn@#e3^ZCYGY$jwJ?rNiQ4wYWu4!Jxb- z^~k9SFe95&$9IV-Kh`i6(=AKm-d}@V0I&dq02aU@ji&v~UNW+(>#Ie9lnaZjyr_Ma z*$1b!bxo%lDiy2hU2KPowiM(((ZHXS%DSFKE{a}f7`9I?TTn%Z9a+9)*2ZqTEx+35 zQzyr!FZ7(ZEy5fqsMjnGr05#KO8z2K`D?D`nR)YF`7l=_1UO&?OaYo6O+7cAtz;gv zGl?cFz=3hPZ!-0kCm34I+EaFJIkNsnhczy@Wntgy@_ArKvdMcr>?ovqtA3o)~kgJ&3PmTMu~NV zVsquWp6*cp(y~ES(oe}?^z|N5Y}V_(6_1T!#Q4ghPSHq2^^7sueIuc$ zthxwSh$(z9d?O*_?Xd9bGb2ok!x0Ml8e6eKjb^*$s(xRKCLya^TspBx&oZygJlRvw z`7q%5THCrr(EGAY^-jZ@(d5sW1IJwQibg}yoA^Jj;rG2fcGzaBXr!ZbRi2y{VAr|> z)0`yFZcWv|2QC>#%2hkDzg^n(VoI8~1i9hRkv#rf$}vM48$tE>tE%uB%FYNU;xmCL zW^=}=?D_Q0BjH9*FomBe9b>C_&r>N$SGwNzbtL|lP$GceQ#-a! z*%yr>G^#zVSgQCHVe<+XS!bbM>M>-aF1~bLM}I~^BHRKgd|7Xs;$fr2kfEb%Ypx8$ zx2GyMnjB57mghZ+pEzyk--Yv0wp@E+eK9TGL0T=J9-G#+7*05*QO1>PM8Q9lR=mIv zosm<%eNP{5_h?vgeEow3r&rpkFG=-qt!3D#tJ*hp@kb||}nC2ImUqI!FBR*~d_`YRMlY#Wzx7pzz?`+=_oTImYmki3U zVLc3{j~=thV9n)Ile{G%pPsY(x9&4CAcomYeLrsdwKZbXvwa4S?Ehzd&R%qLa-B6pwJM5f_Gy#Q-w&TyrY`VRgie{`{*IyZ!1uOc{3Oap z<)2hvNwFIcx%Dae^43=;*P8R_9jRYdGP|D-1Y7S0k6i-ma;-a;?5cQjRa+3dBKkyL z+7AhLLC4nX3gR98Q+jaN%Q4qFms{T+ZcJ@GZ%tMwlClcMgw&-IX~|c~CZ-n~K&vZa z|CN37S;Db9Rof>UknsET!AVKSeuR2$Y`QT^a-}k@&GxRGP+C&I=zB07&i|mG_n-8m z4eM0}6PkUYamPu0mi_pPDU)*Rp&KSNq}mtZ zhS6@99CQB`pyO@15Ze{5U9o&W5O6c|V=cC&D9Egw^ludBqB<5>vFf*6y!O+A<*a=4 z@`IGBLQK_O>^IlWA6|Lay!ns`!T8bmOE3Rqs%vY+Eu-iM!ln16F2OCi!Y+IXlAS#& z8@ZRCk<6k01C`Rf4tghhkU@~8H;U8y#a<`byC+L-8V(rtPF&z+r)nk&%PuctNe>iM zKHYvZOL<", + "CameraBorderLeft(GreenUfo.Layer())" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "CollisionDetector::IsAroundRectangle" - }, - "parameters": [ - "", - "Obstacle", - "Obstacle", - "1280 + 64", - "-128", - "1280 + 128", - "720 + 128", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "MettreX" - }, - "parameters": [ - "Obstacle", - "=", - "-32" - ] - } + "type": { + "value": "PosX" + }, + "parameters": [ + "GreenUfo", + "<", + "CameraBorderRight(GreenUfo.Layer())" + ] + }, + { + "type": { + "value": "PosY" + }, + "parameters": [ + "GreenUfo", + ">", + "CameraBorderTop(GreenUfo.Layer())" + ] + }, + { + "type": { + "value": "PosY" + }, + "parameters": [ + "GreenUfo", + "<", + "CameraBorderBottom(GreenUfo.Layer())" ] } ], - "parameters": [] + "actions": [ + { + "type": { + "value": "ActivateBehavior" + }, + "parameters": [ + "GreenUfo", + "EllipseMovement", + "yes" + ] + } + ] } ], "layers": [ + { + "ambientLightColorB": 8724112, + "ambientLightColorG": 6059824, + "ambientLightColorR": 8689552, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "name": "Background", + "visibility": true, + "cameras": [], + "effects": [] + }, { "ambientLightColorB": 0, "ambientLightColorG": 9943112, @@ -1026,16 +1238,20 @@ ], "behaviorsSharedData": [ { - "name": "Obstacle", - "type": "CollisionDetector::Solid" + "name": "EllipseMovement", + "type": "EllipseMovement::EllipseMovement" + }, + { + "name": "TopDownMovement", + "type": "TopDownMovementBehavior::TopDownMovementBehavior" } ] }, { "b": 37, "disableInputWhenNotFocused": true, - "mangledName": "Screen_32warpping_32_40legacy_41", - "name": "Screen warpping (legacy)", + "mangledName": "Screen_32warpping", + "name": "Screen warpping", "r": 37, "standardSortMethod": true, "stopSoundsOnStartup": true, @@ -1121,15 +1337,9 @@ "effects": [], "behaviors": [ { - "name": "ScreenWrap", - "type": "ScreenWrap::ScreenWrap", - "HorizontalWrapping": true, - "VerticalWrapping": true, - "BorderTop": 0, - "BorderLeft": 0, - "BorderRight": 0, - "BorderBottom": 0, - "TriggerOffset": 0 + "name": "Obstacle", + "type": "CollisionDetector::Solid", + "SolidType": "Mobile" } ], "animations": [ @@ -1174,15 +1384,9 @@ "effects": [], "behaviors": [ { - "name": "ScreenWrap", - "type": "ScreenWrap::ScreenWrap", - "HorizontalWrapping": true, - "VerticalWrapping": true, - "BorderTop": 0, - "BorderLeft": 0, - "BorderRight": 0, - "BorderBottom": 0, - "TriggerOffset": 0 + "name": "Obstacle", + "type": "CollisionDetector::Solid", + "SolidType": "Mobile" } ], "animations": [ @@ -1305,6 +1509,21 @@ "disabled": true, "type": "BuiltinCommonInstructions::Standard", "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "MouseX()", + "MouseY()", + "MouseX()", + "MouseY()", + "" + ] + }, { "type": { "value": "SourisSurObjet" @@ -1334,18 +1553,158 @@ ] } ] - } - ], - "layers": [ + }, { - "ambientLightColorB": 0, - "ambientLightColorG": 9943112, - "ambientLightColorR": 16, - "followBaseLayerCamera": false, - "isLightingLayer": false, - "name": "", - "visibility": true, - "cameras": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Screen wrap", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "-128", + "-128", + "1280 + 128", + "-64", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Obstacle", + "=", + "720" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "-128", + "720 + 64", + "1280 + 128", + "720 + 128", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Obstacle", + "=", + "-32" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "-128", + "-128", + "-64", + "720 + 128", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Obstacle", + "=", + "1280" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "1280 + 64", + "-128", + "1280 + 128", + "720 + 128", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Obstacle", + "=", + "-32" + ] + } + ] + } + ], + "parameters": [] + } + ], + "layers": [ + { + "ambientLightColorB": 0, + "ambientLightColorG": 9943112, + "ambientLightColorR": 16, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "name": "", + "visibility": true, + "cameras": [ { "defaultSize": true, "defaultViewport": true, @@ -1362,16 +1721,16 @@ ], "behaviorsSharedData": [ { - "name": "ScreenWrap", - "type": "ScreenWrap::ScreenWrap" + "name": "Obstacle", + "type": "CollisionDetector::Solid" } ] }, { "b": 37, "disableInputWhenNotFocused": true, - "mangledName": "Separate_32moving_32_40legacy_41", - "name": "Separate moving (legacy)", + "mangledName": "Screen_32warpping_32_40legacy_41", + "name": "Screen warpping (legacy)", "r": 37, "standardSortMethod": true, "stopSoundsOnStartup": true, @@ -1638,18 +1997,36 @@ ] }, { + "disabled": true, "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SeparateFromObjects" + "value": "SourisSurObjet" }, "parameters": [ "Obstacle", - "Obstacle", + "", + "", "" ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "ChangeColor" + }, + "parameters": [ + "Obstacle", + "ToString(Random(255)) + \";\" + ToString(Random(255)) + \";\" + ToString(Random(255))" + ] } ] } @@ -1688,8 +2065,8 @@ { "b": 37, "disableInputWhenNotFocused": true, - "mangledName": "Test_32separate", - "name": "Test separate", + "mangledName": "Separate_32moving", + "name": "Separate moving", "r": 37, "standardSortMethod": true, "stopSoundsOnStartup": true, @@ -1722,202 +2099,51 @@ } ], "variables": [], - "instances": [ + "instances": [], + "objects": [ { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigBrownMeteor1", - "persistentUuid": "f9c940ba-9f2e-4b8f-8333-a872187bf521", - "width": 0, - "x": 983, - "y": 85, - "zOrder": 2, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] + "assetStoreId": "2b2dfbbe01d820384d341ecfa1cf553b2700019a4f78c1d6fc4c55cb4b373bf5", + "name": "RedPlayerShip1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Red playerShip (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] }, { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigBrownMeteor1", - "persistentUuid": "1944b1e4-d9cc-4207-8108-202660699298", - "width": 0, - "x": 504, - "y": 293, - "zOrder": 3, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigBrownMeteor1", - "persistentUuid": "ef6ae8ec-e101-48dc-83cd-80cd9339c82f", - "width": 0, - "x": 960, - "y": 138, - "zOrder": 4, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigBrownMeteor1", - "persistentUuid": "29c24acd-7e01-4587-9e78-ec611f1f1f90", - "width": 0, - "x": 157, - "y": 316, - "zOrder": 5, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigBrownMeteor1", - "persistentUuid": "20553e7b-6091-412f-99e3-744417a7a1f6", - "width": 0, - "x": 1040, - "y": 121, - "zOrder": 6, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigBrownMeteor1", - "persistentUuid": "128cd2f9-0397-44ad-9d5d-7ce7e37276c8", - "width": 0, - "x": 186, - "y": 268, - "zOrder": 7, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigBrownMeteor1", - "persistentUuid": "517150aa-0fbf-4512-b563-c6f08042dba6", - "width": 0, - "x": 570, - "y": 271, - "zOrder": 8, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigGreyMeteor2", - "persistentUuid": "a164943d-79ef-4648-bc7f-58e942730210", - "width": 0, - "x": 903, - "y": 87, - "zOrder": 9, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigGreyMeteor2", - "persistentUuid": "13e04f7b-6347-4bcd-b6f5-99211f26821d", - "width": 0, - "x": 642, - "y": 283, - "zOrder": 10, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigGreyMeteor2", - "persistentUuid": "33b31ac4-6bda-4013-b3cb-2749c5414f1b", - "width": 0, - "x": 550, - "y": 327, - "zOrder": 11, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - } - ], - "objects": [ - { - "assetStoreId": "2b2dfbbe01d820384d341ecfa1cf553b2700019a4f78c1d6fc4c55cb4b373bf5", - "name": "RedPlayerShip1", - "tags": "", - "type": "Sprite", - "updateIfNotVisible": false, - "variables": [], - "effects": [], - "behaviors": [], - "animations": [ - { - "name": "", - "useMultipleDirections": false, - "directions": [ - { - "looping": true, - "timeBetweenFrames": 0.025, - "sprites": [ - { - "hasCustomCollisionMask": false, - "image": "Red playerShip (1).png", - "points": [], - "originPoint": { - "name": "origine", - "x": 0, - "y": 0 - }, - "centerPoint": { - "automatic": true, - "name": "centre", - "x": 0, - "y": 0 - }, - "customCollisionMask": [] - } - ] - } - ] - } - ] - }, - { - "assetStoreId": "911c6f50a4c05507c6fc1df967493f61a7ce9bad9e144cec92f6ff32be42749a", + "assetStoreId": "911c6f50a4c05507c6fc1df967493f61a7ce9bad9e144cec92f6ff32be42749a", "name": "BigBrownMeteor1", "tags": "", "type": "Sprite", @@ -1927,7 +2153,8 @@ "behaviors": [ { "name": "Obstacle", - "type": "CollisionDetector::Solid" + "type": "CollisionDetector::Solid", + "SolidType": "Mobile" } ], "animations": [ @@ -1973,7 +2200,8 @@ "behaviors": [ { "name": "Obstacle", - "type": "CollisionDetector::Solid" + "type": "CollisionDetector::Solid", + "SolidType": "Mobile" } ], "animations": [ @@ -2025,49 +2253,256 @@ "actions": [], "events": [ { - "type": "BuiltinCommonInstructions::Standard", + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "512", "conditions": [], "actions": [ { "type": { - "value": "CollisionDetector::Separate" + "value": "Create" }, "parameters": [ "", - "Obstacle", + "BigBrownMeteor1", + "RandomInRange(0, 1280)", + "RandomInRange(0, 720)", + "" + ] + } + ] + }, + { + "disabled": true, + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "128", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ "", + "BigGreyMeteor2", + "RandomInRange(0, 1280)", + "RandomInRange(0, 720)", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ChangeScale" + }, + "parameters": [ "Obstacle", - "Obstacle" + "=", + "0.25" + ] + }, + { + "type": { + "value": "AddForceAL" + }, + "parameters": [ + "Obstacle", + "Random(360)", + "100", + "1" ] } ] } ] - } - ], - "layers": [ + }, { - "ambientLightColorB": 0, - "ambientLightColorG": 9943112, - "ambientLightColorR": 16, - "followBaseLayerCamera": false, - "isLightingLayer": false, - "name": "", - "visibility": true, - "cameras": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "defaultSize": true, - "defaultViewport": true, - "height": 0, - "viewportBottom": 1, - "viewportLeft": 0, - "viewportRight": 1, - "viewportTop": 0, - "width": 0 - } - ], - "effects": [] - } + "type": { + "value": "CollisionDetector::Separate" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "Obstacle", + "Obstacle", + "" + ] + } + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Screen wrap", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "-128", + "-128", + "1280 + 128", + "-64", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Obstacle", + "=", + "720" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "-128", + "720 + 64", + "1280 + 128", + "720 + 128", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Obstacle", + "=", + "-32" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "-128", + "-128", + "-64", + "720 + 128", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Obstacle", + "=", + "1280" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "1280 + 64", + "-128", + "1280 + 128", + "720 + 128", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Obstacle", + "=", + "-32" + ] + } + ] + } + ], + "parameters": [] + } + ], + "layers": [ + { + "ambientLightColorB": 0, + "ambientLightColorG": 9943112, + "ambientLightColorR": 16, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "name": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } ], "behaviorsSharedData": [ { @@ -2079,8 +2514,8 @@ { "b": 37, "disableInputWhenNotFocused": true, - "mangledName": "Test_32IsAround", - "name": "Test IsAround", + "mangledName": "Separate_32moving_32_40legacy_41", + "name": "Separate moving (legacy)", "r": 37, "standardSortMethod": true, "stopSoundsOnStartup": true, @@ -2113,217 +2548,51 @@ } ], "variables": [], - "instances": [ + "instances": [], + "objects": [ { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", + "assetStoreId": "2b2dfbbe01d820384d341ecfa1cf553b2700019a4f78c1d6fc4c55cb4b373bf5", "name": "RedPlayerShip1", - "persistentUuid": "9ff2bb0e-b2eb-4b93-81af-c0444469469c", - "width": 0, - "x": 485, - "y": 369, - "zOrder": 1, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigBrownMeteor1", - "persistentUuid": "f9c940ba-9f2e-4b8f-8333-a872187bf521", - "width": 0, - "x": 983, - "y": 85, - "zOrder": 2, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Red playerShip (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] }, { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigBrownMeteor1", - "persistentUuid": "1944b1e4-d9cc-4207-8108-202660699298", - "width": 0, - "x": 413, - "y": 149, - "zOrder": 3, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigBrownMeteor1", - "persistentUuid": "ef6ae8ec-e101-48dc-83cd-80cd9339c82f", - "width": 0, - "x": 691, - "y": 515, - "zOrder": 4, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigBrownMeteor1", - "persistentUuid": "29c24acd-7e01-4587-9e78-ec611f1f1f90", - "width": 0, - "x": 115, - "y": 524, - "zOrder": 5, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigBrownMeteor1", - "persistentUuid": "20553e7b-6091-412f-99e3-744417a7a1f6", - "width": 0, - "x": 1073, - "y": 494, - "zOrder": 6, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigBrownMeteor1", - "persistentUuid": "128cd2f9-0397-44ad-9d5d-7ce7e37276c8", - "width": 0, - "x": 186, - "y": 268, - "zOrder": 7, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigBrownMeteor1", - "persistentUuid": "517150aa-0fbf-4512-b563-c6f08042dba6", - "width": 0, - "x": 685, - "y": 211, - "zOrder": 8, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigGreyMeteor2", - "persistentUuid": "a164943d-79ef-4648-bc7f-58e942730210", - "width": 0, - "x": 166, - "y": 111, - "zOrder": 9, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigGreyMeteor2", - "persistentUuid": "13e04f7b-6347-4bcd-b6f5-99211f26821d", - "width": 0, - "x": 903, - "y": 292, - "zOrder": 10, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "", - "name": "BigGreyMeteor2", - "persistentUuid": "33b31ac4-6bda-4013-b3cb-2749c5414f1b", - "width": 0, - "x": 404, - "y": 574, - "zOrder": 11, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - } - ], - "objects": [ - { - "assetStoreId": "2b2dfbbe01d820384d341ecfa1cf553b2700019a4f78c1d6fc4c55cb4b373bf5", - "name": "RedPlayerShip1", - "tags": "", - "type": "Sprite", - "updateIfNotVisible": false, - "variables": [], - "effects": [], - "behaviors": [], - "animations": [ - { - "name": "", - "useMultipleDirections": false, - "directions": [ - { - "looping": true, - "timeBetweenFrames": 0.025, - "sprites": [ - { - "hasCustomCollisionMask": false, - "image": "Red playerShip (1).png", - "points": [], - "originPoint": { - "name": "origine", - "x": 0, - "y": 0 - }, - "centerPoint": { - "automatic": true, - "name": "centre", - "x": 0, - "y": 0 - }, - "customCollisionMask": [] - } - ] - } - ] - } - ] - }, - { - "assetStoreId": "911c6f50a4c05507c6fc1df967493f61a7ce9bad9e144cec92f6ff32be42749a", + "assetStoreId": "911c6f50a4c05507c6fc1df967493f61a7ce9bad9e144cec92f6ff32be42749a", "name": "BigBrownMeteor1", "tags": "", "type": "Sprite", @@ -2332,8 +2601,15 @@ "effects": [], "behaviors": [ { - "name": "Obstacle", - "type": "CollisionDetector::Solid" + "name": "ScreenWrap", + "type": "ScreenWrap::ScreenWrap", + "HorizontalWrapping": true, + "VerticalWrapping": true, + "BorderTop": 0, + "BorderLeft": 0, + "BorderRight": 0, + "BorderBottom": 0, + "TriggerOffset": 0 } ], "animations": [ @@ -2378,8 +2654,15 @@ "effects": [], "behaviors": [ { - "name": "Obstacle", - "type": "CollisionDetector::Solid" + "name": "ScreenWrap", + "type": "ScreenWrap::ScreenWrap", + "HorizontalWrapping": true, + "VerticalWrapping": true, + "BorderTop": 0, + "BorderLeft": 0, + "BorderRight": 0, + "BorderBottom": 0, + "TriggerOffset": 0 } ], "animations": [ @@ -2420,95 +2703,4647 @@ "type": "BuiltinCommonInstructions::Standard", "conditions": [ { - "type": { - "value": "DepartScene" - }, - "parameters": [ - "" - ] - } - ], - "actions": [], - "events": [ + "type": { + "value": "DepartScene" + }, + "parameters": [ + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "512", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "BigBrownMeteor1", + "RandomInRange(0, 1280)", + "RandomInRange(0, 720)", + "" + ] + } + ] + }, + { + "disabled": true, + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "128", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "BigGreyMeteor2", + "RandomInRange(0, 1280)", + "RandomInRange(0, 720)", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ChangeScale" + }, + "parameters": [ + "Obstacle", + "=", + "0.25" + ] + }, + { + "type": { + "value": "AddForceAL" + }, + "parameters": [ + "Obstacle", + "Random(360)", + "100", + "1" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SeparateFromObjects" + }, + "parameters": [ + "Obstacle", + "Obstacle", + "" + ] + } + ] + } + ], + "layers": [ + { + "ambientLightColorB": 0, + "ambientLightColorG": 9943112, + "ambientLightColorR": 16, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "name": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "behaviorsSharedData": [ + { + "name": "ScreenWrap", + "type": "ScreenWrap::ScreenWrap" + } + ] + }, + { + "b": 37, + "disableInputWhenNotFocused": true, + "mangledName": "Test_32separate", + "name": "Test separate", + "r": 37, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 37, + "uiSettings": { + "grid": false, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": false, + "zoomFactor": 0.546875, + "windowMask": false + }, + "objectsGroups": [ + { + "name": "Obstacle", + "objects": [ + { + "name": "BigBrownMeteor1" + }, + { + "name": "BigGreyMeteor2" + } + ] + } + ], + "variables": [], + "instances": [ + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "f9c940ba-9f2e-4b8f-8333-a872187bf521", + "width": 0, + "x": 983, + "y": 85, + "zOrder": 2, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "1944b1e4-d9cc-4207-8108-202660699298", + "width": 0, + "x": 504, + "y": 293, + "zOrder": 3, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "ef6ae8ec-e101-48dc-83cd-80cd9339c82f", + "width": 0, + "x": 960, + "y": 138, + "zOrder": 4, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "29c24acd-7e01-4587-9e78-ec611f1f1f90", + "width": 0, + "x": 157, + "y": 316, + "zOrder": 5, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "20553e7b-6091-412f-99e3-744417a7a1f6", + "width": 0, + "x": 1040, + "y": 121, + "zOrder": 6, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "128cd2f9-0397-44ad-9d5d-7ce7e37276c8", + "width": 0, + "x": 186, + "y": 268, + "zOrder": 7, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "517150aa-0fbf-4512-b563-c6f08042dba6", + "width": 0, + "x": 570, + "y": 271, + "zOrder": 8, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigGreyMeteor2", + "persistentUuid": "a164943d-79ef-4648-bc7f-58e942730210", + "width": 0, + "x": 903, + "y": 87, + "zOrder": 9, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigGreyMeteor2", + "persistentUuid": "13e04f7b-6347-4bcd-b6f5-99211f26821d", + "width": 0, + "x": 642, + "y": 283, + "zOrder": 10, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigGreyMeteor2", + "persistentUuid": "33b31ac4-6bda-4013-b3cb-2749c5414f1b", + "width": 0, + "x": 550, + "y": 327, + "zOrder": 11, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "objects": [ + { + "assetStoreId": "2b2dfbbe01d820384d341ecfa1cf553b2700019a4f78c1d6fc4c55cb4b373bf5", + "name": "RedPlayerShip1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Red playerShip (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "911c6f50a4c05507c6fc1df967493f61a7ce9bad9e144cec92f6ff32be42749a", + "name": "BigBrownMeteor1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Brown Meteor (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "fe9de3e97f21ea1ff6d364d2efe3e7d379cb150152cc2461b10d1ed05f803d09", + "name": "BigGreyMeteor2", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Grey Meteor (2).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DepartScene" + }, + "parameters": [ + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CollisionDetector::Separate" + }, + "parameters": [ + "", + "Obstacle", + "", + "Obstacle", + "Obstacle" + ] + } + ] + } + ] + } + ], + "layers": [ + { + "ambientLightColorB": 0, + "ambientLightColorG": 9943112, + "ambientLightColorR": 16, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "name": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "behaviorsSharedData": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ] + }, + { + "b": 37, + "disableInputWhenNotFocused": true, + "mangledName": "Test_32IsAround", + "name": "Test IsAround", + "r": 37, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 37, + "uiSettings": { + "grid": false, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": false, + "zoomFactor": 0.546875, + "windowMask": false + }, + "objectsGroups": [ + { + "name": "Obstacle", + "objects": [ + { + "name": "BigBrownMeteor1" + }, + { + "name": "BigGreyMeteor2" + } + ] + } + ], + "variables": [], + "instances": [ + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "RedPlayerShip1", + "persistentUuid": "9ff2bb0e-b2eb-4b93-81af-c0444469469c", + "width": 0, + "x": 485, + "y": 369, + "zOrder": 1, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "f9c940ba-9f2e-4b8f-8333-a872187bf521", + "width": 0, + "x": 983, + "y": 85, + "zOrder": 2, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "1944b1e4-d9cc-4207-8108-202660699298", + "width": 0, + "x": 413, + "y": 149, + "zOrder": 3, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "ef6ae8ec-e101-48dc-83cd-80cd9339c82f", + "width": 0, + "x": 691, + "y": 515, + "zOrder": 4, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "29c24acd-7e01-4587-9e78-ec611f1f1f90", + "width": 0, + "x": 115, + "y": 524, + "zOrder": 5, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "20553e7b-6091-412f-99e3-744417a7a1f6", + "width": 0, + "x": 1073, + "y": 494, + "zOrder": 6, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "128cd2f9-0397-44ad-9d5d-7ce7e37276c8", + "width": 0, + "x": 186, + "y": 268, + "zOrder": 7, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "517150aa-0fbf-4512-b563-c6f08042dba6", + "width": 0, + "x": 685, + "y": 211, + "zOrder": 8, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigGreyMeteor2", + "persistentUuid": "a164943d-79ef-4648-bc7f-58e942730210", + "width": 0, + "x": 166, + "y": 111, + "zOrder": 9, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigGreyMeteor2", + "persistentUuid": "13e04f7b-6347-4bcd-b6f5-99211f26821d", + "width": 0, + "x": 903, + "y": 292, + "zOrder": 10, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigGreyMeteor2", + "persistentUuid": "33b31ac4-6bda-4013-b3cb-2749c5414f1b", + "width": 0, + "x": 404, + "y": 574, + "zOrder": 11, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "objects": [ + { + "assetStoreId": "2b2dfbbe01d820384d341ecfa1cf553b2700019a4f78c1d6fc4c55cb4b373bf5", + "name": "RedPlayerShip1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Red playerShip (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "911c6f50a4c05507c6fc1df967493f61a7ce9bad9e144cec92f6ff32be42749a", + "name": "BigBrownMeteor1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Brown Meteor (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "fe9de3e97f21ea1ff6d364d2efe3e7d379cb150152cc2461b10d1ed05f803d09", + "name": "BigGreyMeteor2", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Grey Meteor (2).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DepartScene" + }, + "parameters": [ + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "640", + "0", + "1280", + "720", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "DebuggerTools::ConsoleLog" + }, + "parameters": [ + "\"Brown: \" + ToString(PickedInstancesCount(BigBrownMeteor1))", + "", + "" + ] + }, + { + "type": { + "value": "DebuggerTools::ConsoleLog" + }, + "parameters": [ + "\"Grey: \" + ToString(PickedInstancesCount(BigGreyMeteor2))", + "", + "" + ] + } + ] + } + ] + } + ], + "layers": [ + { + "ambientLightColorB": 0, + "ambientLightColorG": 9943112, + "ambientLightColorR": 16, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "name": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "behaviorsSharedData": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ] + } + ], + "externalEvents": [], + "eventsFunctionsExtensions": [ + { + "author": "", + "category": "Movement", + "extensionNamespace": "", + "fullName": "Boids movement (experimental)", + "helpPath": "https://en.wikipedia.org/wiki/Boids", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8Zz4NCgk8cGF0aCBkPSJNMjkuMywxMC4xYy0wLjQtMC4xLTAuOCwwLTEuMSwwLjNsLTMuMiw0Yy0xLjctMi01LjktNi40LTExLTYuNGMtMC4yLDAtMC4zLDAtMC41LDBjMS40LDIuNCwyLjEsNS4xLDIuMSw4DQoJCWMwLDIuOC0wLjcsNS42LTIuMSw4YzAuMiwwLDAuMywwLDAuNSwwYzUuMSwwLDkuMy00LjMsMTEtNi40bDMuMiw0YzAuMiwwLjIsMC41LDAuNCwwLjgsMC40YzAuMSwwLDAuMiwwLDAuMy0wLjENCgkJYzAuNC0wLjEsMC43LTAuNSwwLjctMC45VjExQzMwLDEwLjYsMjkuNywxMC4yLDI5LjMsMTAuMXoiLz4NCgk8cGF0aCBkPSJNMTEuNCw4LjRjLTUuMiwxLjUtOSw2LjgtOS4yLDdjLTAuMiwwLjMtMC4yLDAuOCwwLDEuMmMwLjIsMC4zLDQsNS42LDkuMiw3YzEuNS0yLjMsMi4yLTQuOSwyLjItNy42DQoJCUMxMy42LDEzLjMsMTIuOCwxMC42LDExLjQsOC40eiBNMTAsMTZjMCwwLjYtMC40LDEtMSwxcy0xLTAuNC0xLTF2LTJjMC0wLjYsMC40LTEsMS0xczEsMC40LDEsMVYxNnoiLz4NCjwvZz4NCjwvc3ZnPg0K", + "name": "BoidsMovement", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Glyphster Pack/Master/SVG/Restaurant/Restaurant_restaurant_seafood_animal_fish.svg", + "shortDescription": "Simulates flocks movement.", + "version": "0.1.6", + "description": [ + "Simulates swarms or flocks movement following the separation, alignment, cohesion principles. The flock can be attracted to a location or avoid some obstacles.", + "", + "The [Fish School example](https://editor.gdevelop.io/?project=example://fish-school) shows how properties impact on the movement." + ], + "origin": { + "identifier": "BoidsMovement", + "name": "gdevelop-extension-store" + }, + "tags": [ + "flock", + "swarm", + "boids", + "crowd", + "horde" + ], + "authorIds": [ + "rotBq28wITdtfsrE7McHQri4k2w2", + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" + ], + "dependencies": [], + "eventsFunctions": [ + { + "description": "Define JavaScript classes.", + "fullName": "Define JavaScript classes", + "functionType": "Action", + "name": "DefineJavaScript", + "private": true, + "sentence": "Define JavaScript classes", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GlobalVariableAsBoolean" + }, + "parameters": [ + "__BoidsMovement_ClassesDefined", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetGlobalVariableAsBoolean" + }, + "parameters": [ + "__BoidsMovement_ClassesDefined", + "True" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "gdjs.__boidsExtension = gdjs.__boidsExtension || {};", + "", + "/**", + " * A vector", + " * @param {float} x - coordinate of the vectors starting position", + " * @param {float} y - coordinate of the vectors starting position", + " * @constructor", + " */", + "gdjs.__boidsExtension.Vector = /** @class */ (function () {", + " ", + " /**", + " * Create a vector.", + " * @param {number} x", + " * @param {number} y", + " */", + " function Vector(x, y) {", + " this.x = x;", + " this.y = y;", + " }", + "", + " /**", + " * @param {number} x", + " * @param {number} y", + " * @returns {Vector} this object", + " */", + " Vector.prototype.set = function (x, y) {", + " this.x = x;", + " this.y = y;", + " return this;", + " }", + "", + " /**", + " * Adds a velocity to this vector", + " * @param {Vector} referenceVector gets the velocity to be added", + " * @returns {Vector} this object", + " */", + " Vector.prototype.add = function (referenceVector) {", + " this.x += referenceVector.x;", + " this.y += referenceVector.y;", + "", + " return this;", + " }", + "", + " /**", + " * Normalize the vector", + " * @returns {Vector}", + " */", + " Vector.prototype.normalize = function () {", + " var len = this.magnitude();", + " if (len !== 0) this.multiply(1 / len);", + " return this;", + " }", + "", + " /**", + " * Multiply vectors verticies", + " * @param {float} amount", + " * @returns {Vector}", + " */", + " Vector.prototype.multiply = function (amount) {", + " this.x *= amount;", + " this.y *= amount;", + " return this;", + " }", + "", + " /**", + " * Divide vectors verticies", + " * @param {float} amount", + " * @returns {Vector}", + " */", + " Vector.prototype.divide = function (amount) {", + " this.x /= amount;", + " this.y /= amount;", + "", + " return this;", + " }", + "", + " /**", + " * Subtracts vectors verticies from a reference vector", + " * @param {Vector} referenceVector", + " * @returns {Vector}", + " */", + " Vector.prototype.subtract = function (referenceVector) {", + " this.x -= referenceVector.x;", + " this.y -= referenceVector.y;", + "", + " return this;", + " }", + "", + " /**", + " * Limits Vectors speed", + " * @returns {Vector}", + " */", + " Vector.prototype.limit = function limit(max) {", + " var mSq = this.magnitudeSquare();", + " if (mSq > max * max) {", + " this.divide(Math.sqrt(mSq)).multiply(max);", + " }", + " return this;", + " }", + "", + " /**", + " * Calculate the vectors direction", + " * @returns {float}", + " */", + " Vector.prototype.heading = function () {", + " let h = Math.atan2(this.y, this.x);", + " return h;", + " }", + "", + " /**", + " * Calculate the vectors magnitude squared", + " * @returns {float}", + " */", + " Vector.prototype.magnitudeSquare = function () {", + " var x = this.x;", + " var y = this.y;", + " return x * x + y * y;", + " };", + "", + " /**", + " * Calculate the vectors magnitude", + " * @returns {float}", + " */", + " Vector.prototype.magnitude = function () {", + " return Math.sqrt(this.magnitudeSquare());", + " }", + " ", + " return Vector;", + "}());", + "", + "/**", + " * A boid agent", + " * Methods for Separation, Cohesion, Alignment added", + " * Inspired from The Nature of Code - Daniel Shiffman", + " * http://natureofcode.com", + " * ", + " * Original source code:", + " * https://github.com/nature-of-code/noc-examples-processing/blob/master/chp06_agents/NOC_6_09_Flocking/Boid.pde", + " */", + "gdjs.__boidsExtension.Boid = /** @class */ (function () {", + "", + " /**", + " * Create a boid agent.", + " * @parameter {gdjs.RuntimeBehavior} behavior", + " */", + " function Boid(behavior) {", + " /** @type {gdjs.RuntimeBehavior} */", + " this.behavior = behavior;", + " this.acceleration = new gdjs.__boidsExtension.Vector(0, 0);", + " this.velocity = new gdjs.__boidsExtension.Vector(gdjs.randomFloatInRange(-1, 1), gdjs.randomFloatInRange(-1, 1));", + " this.separationDirection = new gdjs.__boidsExtension.Vector(0, 0);", + " this.alignmentDirection = new gdjs.__boidsExtension.Vector(0, 0);", + " this.cohesionDirection = new gdjs.__boidsExtension.Vector(0, 0);", + " this.customIntentsDirectionSum = new gdjs.__boidsExtension.Vector(0, 0);", + " this.separateWorkingVector = new gdjs.__boidsExtension.Vector(0, 0);", + " }", + "", + " /**", + " * Add a custom intent.", + " * @param {Boid} boid", + " * @param {number} directionX", + " * @param {number} directionY", + " * @param {number} weight", + " */", + " Boid.prototype.addIntent = function (directionX, directionY, weight) {", + "", + " if (directionX === 0 && directionY === 0) {", + " return;", + " }", + "", + " const length = Math.hypot(directionX, directionY);", + " const unitX = directionX / length;", + " const unitY = directionY / length;", + "", + " this.customIntentsDirectionSum.x += unitX * weight;", + " this.customIntentsDirectionSum.y += unitY * weight;", + " }", + "", + " /**", + " * Vector between 2 boids.", + " * @param {Boid} boid", + " * @param {Vector} vector the vector to return the result", + " * @returns {Vector} vector", + " */", + " Boid.prototype.getVectorTo = function (boid, vector) {", + " const object = this.behavior.owner;", + " const otherObject = boid.behavior.owner;", + " let x = otherObject.x - object.x;", + " let y = otherObject.y - object.y;", + " vector.set(x, y);", + " return vector;", + " }", + "", + " /**", + " * Applys the three rules of boids", + " */", + " Boid.prototype.flock = function () {", + " const separationDirection = this.separate();", + " const alignmentDirection = this.align();", + " const cohesionDirection = this.cohesion();", + "", + " separationDirection.multiply(this.behavior.SeparationWeight());", + " alignmentDirection.multiply(this.behavior.AlignmentWeight());", + " cohesionDirection.multiply(this.behavior.CohesionWeight());", + "", + " const direction = separationDirection.add(alignmentDirection).add(cohesionDirection).add(this.customIntentsDirectionSum);", + " this.acceleration.add(this.steer(direction));", + "", + " this.customIntentsDirectionSum.set(0, 0);", + " }", + "", + " /**", + " * Apply the acceleration from the steer force.", + " */", + " Boid.prototype.move = function () {", + " const object = this.behavior.owner;", + " const timeDelta = object.getElapsedTime(object.getInstanceContainer()) / 1000;", + " this.acceleration.multiply(timeDelta);", + "", + " const previousVelocityX = this.velocity.x;", + " const previousVelocityY = this.velocity.y;", + "", + " this.velocity.add(this.acceleration);", + " this.velocity.limit(this.behavior.MaxSpeed());", + " this.acceleration.set(0, 0);", + "", + " if (this.behavior.ShouldRotate()) {", + " let theta = this.velocity.heading() * 180 / Math.PI;", + " object.setAngle(theta);", + " }", + " // Verlet integration", + " object.setX(object.x + (previousVelocityX + this.velocity.x) / 2 * timeDelta);", + " object.setY(object.y + (previousVelocityY + this.velocity.y) / 2 * timeDelta);", + " }", + "", + " /**", + " * Calculates and applies steering force towards a direction", + " * @param desiredDirection {Vector}", + " * @return {Vector} alignment force", + " */", + " Boid.prototype.steer = function (desiredDirection) {", + " desiredDirection.normalize();", + " desiredDirection.multiply(this.behavior.MaxSpeed());", + " let steer = desiredDirection.subtract(this.velocity);", + " steer.limit(this.behavior.MaxAcceleration());", + " return steer;", + " }", + "", + " /**", + " * Separation: checks for nearby boids.", + " * @return {Vector} separation direction", + " */", + " Boid.prototype.separate = function () {", + " const runtimeScene = this.behavior.owner.getInstanceContainer();", + " /** @type {gdjs.__boidsExtension.BoidsManager} */", + " const manager = runtimeScene.__boidsExtension.boidsManager;", + " const separationRadius = this.behavior.SeparationRadius();", + " this.separationDirection.set(0, 0);", + " let diff = this.separateWorkingVector;", + " const object = this.behavior.owner;", + "", + " const nearbyBoids = manager.getAllBoidsAround(this, separationRadius);", + " for (let i = 0; i < nearbyBoids.length; i++) {", + " const boid = nearbyBoids[i];", + " const otherObject = boid.behavior.owner;", + " const distance = object.getDistanceToObject(otherObject);", + " if (distance > 0) {", + " diff = boid.getVectorTo(this, diff);", + " diff.normalize();", + " diff.divide(distance);", + " this.separationDirection.add(diff);", + " }", + " }", + " if (this.separationDirection.magnitudeSquare() > 0) {", + " this.separationDirection.normalize();", + " }", + " return this.separationDirection;", + " }", + "", + " /**", + " * Alignment: calculate the average velocity for every nearby boid in the system", + " * @return {Vector} alignment direction", + " */", + " Boid.prototype.align = function () {", + " const runtimeScene = this.behavior.owner.getInstanceContainer();", + " /** @type {gdjs.__boidsExtension.BoidsManager} */", + " const manager = runtimeScene.__boidsExtension.boidsManager;", + " const alignmentRadius = this.behavior.AlignmentRadius();", + " this.alignmentDirection.set(0, 0);", + " let count = 0;", + " const object = this.behavior.owner;", + "", + " const nearbyBoids = manager.getAllBoidsAround(this, alignmentRadius);", + " for (let i = 0; i < nearbyBoids.length; i++) {", + " const boid = nearbyBoids[i];", + " this.alignmentDirection.add(boid.velocity);", + " count++;", + " }", + " if (count > 0) {", + " this.alignmentDirection.normalize();", + " }", + " return this.alignmentDirection;", + " }", + "", + " /**", + " * Cohesion: calculate direction vector towards the average location of all nearby boids", + " * @return {Vector} cohesion direction", + " */", + " Boid.prototype.cohesion = function () {", + " const runtimeScene = this.behavior.owner.getInstanceContainer();", + " /** @type {gdjs.__boidsExtension.BoidsManager} */", + " const manager = runtimeScene.__boidsExtension.boidsManager;", + " const cohesionRadius = this.behavior.CohesionRadius();", + " let count = 0;", + " let sumX = 0;", + " let sumY = 0;", + " const object = this.behavior.owner;", + "", + " const nearbyBoids = manager.getAllBoidsAround(this, cohesionRadius);", + " for (let i = 0; i < nearbyBoids.length; i++) {", + " const boid = nearbyBoids[i];", + " const otherObject = boid.behavior.owner;", + " sumX += otherObject.getCenterXInScene();", + " sumY += otherObject.getCenterYInScene();", + " count++;", + " }", + " if (count > 0) {", + " sumX /= count;", + " sumY /= count;", + "", + " // A vector pointing from the position to the target", + " this.cohesionDirection.set(", + " sumX - object.getCenterXInScene(),", + " sumY - object.getCenterYInScene()", + " )", + " }", + " return this.cohesionDirection.normalize();", + " }", + "", + " return Boid;", + "}());", + "", + "/**", + " * A boids manager", + " */", + "gdjs.__boidsExtension.BoidsManager = /** @class */ (function () {", + " /**", + " * Create a manager.", + " */", + " function BoidsManager() {", + " /**", + " * @type {Map}", + " */", + " this.boids = new Map();", + " this.boidsRBush = new rbush();", + " }", + "", + " /**", + " * Create and register a boid.", + " * @param {gdjs.RuntimeBehavior} behavior", + " * @returns {Boid} the created Boid", + " */", + " BoidsManager.prototype.add = function (behavior) {", + " const boid = new gdjs.__boidsExtension.Boid(behavior);", + " this.boids.set(behavior.owner.id, boid);", + " this.addToRBush(boid);", + " return boid;", + " }", + "", + " /**", + " * Add a boid to the R-Tree.", + " * @param {Boid} boid", + " */", + " BoidsManager.prototype.addToRBush = function (boid) {", + " if (boid.currentRBushAABB) {", + " boid.currentRBushAABB.updateAABBFromOwner();", + " }", + " else {", + " boid.currentRBushAABB = new gdjs.BehaviorRBushAABB(", + " boid.behavior", + " );", + " }", + " this.boidsRBush.insert(boid.currentRBushAABB);", + " }", + "", + " /**", + " * Unregister the boid.", + " * @param {gdjs.RuntimeBehavior} behavior", + " */", + " BoidsManager.prototype.remove = function (behavior) {", + " this.boids.delete(behavior.owner.id);", + "", + " this.removeFromRBush(behavior.__boidsExtension.boid.currentRBushAABB);", + " }", + "", + " /**", + " * Remove a boid from the R-Tree.", + " * @param {Boid} boid", + " */", + " BoidsManager.prototype.removeFromRBush = function (boid) {", + " this.boidsRBush.remove(boid.currentRBushAABB);", + " }", + "", + " /**", + " * Move all instances.", + " */", + " BoidsManager.prototype.moveAll = function () {", + " this.boids.forEach(boid => boid.flock());", + " this.boids.forEach(boid => {", + " boid.move();", + " this.removeFromRBush(boid);", + " this.addToRBush(boid);", + " });", + " }", + "", + " /**", + " * Returns all the boids around the specified boid.", + " * @param {Boid} boid", + " * @param {number} radius", + " * @return {Boid[]} An array with all boids near the object.", + " */", + " BoidsManager.prototype.getAllBoidsAround = function (boid, radius, results) {", + " const object = boid.behavior.owner;", + "", + " const x = object.getCenterXInScene();", + " const y = object.getCenterYInScene();", + " const searchArea = gdjs.staticObject(", + " gdjs.__boidsExtension.BoidsManager.prototype.getAllBoidsAround", + " );", + " searchArea.minX = x - radius;", + " searchArea.minY = y - radius;", + " searchArea.maxX = x + radius;", + " searchArea.maxY = y + radius;", + " // TODO The R-Tree should not allocate an array.", + " const nearbys = this.boidsRBush.search(searchArea);", + "", + " const radiusSq = radius * radius;", + " const result = gdjs.staticArray(", + " gdjs.__boidsExtension.BoidsManager.prototype.getAllBoidsAround", + " );", + " result.length = 0;", + " // Cap the number of boids between 20 and 40.", + " const step = Math.ceil(nearbys.length / 40);", + " for (let i = 0; i < nearbys.length; i += step) {", + " const behavior = nearbys[i].behavior;", + " const otherObject = behavior.owner;", + " if (object === otherObject) {", + " continue;", + " }", + " const distanceSq = object.getSqDistanceToObject(otherObject);", + " if (distanceSq < radiusSq) {", + " result.push(behavior.__boidsExtension.boid);", + " }", + " }", + " return result;", + " }", + "", + " return BoidsManager;", + "}());", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ] + } + ], + "parameters": [], + "objectGroups": [] + } + ], + "eventsBasedBehaviors": [ + { + "description": "Move as part of a flock.", + "fullName": "Boids Movement (experimental)", + "name": "BoidsMovement", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Initiate and attach properties as objects variables", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::DefineJavaScript" + }, + "parameters": [ + "", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "\r", + "runtimeScene.__boidsExtension = runtimeScene.__boidsExtension || {};\r", + "runtimeScene.__boidsExtension.boidsManager = runtimeScene.__boidsExtension.boidsManager || new gdjs.__boidsExtension.BoidsManager();\r", + "\r", + "const object = objects[0];\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "const behavior = object.getBehavior(behaviorName);\r", + "behavior.__boidsExtension = behavior.__boidsExtension || {};\r", + "behavior.__boidsExtension.boid = runtimeScene.__boidsExtension.boidsManager.add(behavior);" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Update boids position every frame", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneVariableAsBoolean" + }, + "parameters": [ + "__BoidsBehaviour_hasAlreadyRunThisFrame", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetSceneVariableAsBoolean" + }, + "parameters": [ + "__BoidsBehaviour_hasAlreadyRunThisFrame", + "True" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": "runtimeScene.__boidsExtension.boidsManager.moveAll();", + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPostEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetSceneVariableAsBoolean" + }, + "parameters": [ + "__BoidsBehaviour_hasAlreadyRunThisFrame", + "False" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onActivate", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "const behavior = object.getBehavior(behaviorName);", + "runtimeScene.__boidsExtension.boidsManager.add(behavior);" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onDeActivate", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "const behavior = object.getBehavior(behaviorName);", + "runtimeScene.__boidsExtension.boidsManager.remove(behavior);" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onDestroy", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "\r", + "const object = objects[0];\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "const behavior = object.getBehavior(behaviorName);\r", + "runtimeScene.__boidsExtension.boidsManager.remove(behavior);" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Intend to move in a given direction.", + "fullName": "Move in a direction", + "functionType": "Action", + "name": "MoveInDirection", + "sentence": "_PARAM0_ intent to move in the direction _PARAM2_; _PARAM3_ (decision weight: _PARAM4_)", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "const behavior = object.getBehavior(behaviorName);", + "const directionX = eventsFunctionContext.getArgument(\"DirectionX\");", + "const directionY = eventsFunctionContext.getArgument(\"DirectionY\");", + "const decisionWeight = eventsFunctionContext.getArgument(\"DecisionWeight\");", + "", + "behavior.__boidsExtension.boid.addIntent(directionX, directionY, decisionWeight);" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Direction X", + "name": "DirectionX", + "type": "expression" + }, + { + "description": "Direction Y", + "name": "DirectionY", + "type": "expression" + }, + { + "description": "Decision weight", + "name": "DecisionWeight", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Intend to move toward a position.", + "fullName": "Move toward a position", + "functionType": "Action", + "name": "MoveToPosition", + "sentence": "_PARAM0_ intend to move toward _PARAM2_; _PARAM3_ (decision weight: _PARAM4_)", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::MoveInDirection" + }, + "parameters": [ + "Object", + "Behavior", + "GetArgumentAsNumber(\"TargetX\") - Object.CenterX()", + "GetArgumentAsNumber(\"TargetY\") - Object.CenterY()", + "GetArgumentAsNumber(\"DecisionWeight\")", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Target X", + "name": "TargetX", + "type": "expression" + }, + { + "description": "Target Y", + "name": "TargetY", + "type": "expression" + }, + { + "description": "Decision weight", + "name": "DecisionWeight", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Intend to move toward an object.", + "fullName": "Move toward an object", + "functionType": "Action", + "name": "MoveToObject", + "sentence": "_PARAM0_ intend to move toward _PARAM2_ (decision weight: _PARAM3_)", + "events": [ + { + "type": "BuiltinCommonInstructions::ForEach", + "object": "TargetedObject", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::MoveToPosition" + }, + "parameters": [ + "Object", + "Behavior", + "TargetedObject.CenterX()", + "TargetedObject.CenterY()", + "GetArgumentAsNumber(\"DecisionWeight\")", + "GetArgumentAsNumber(\"DecisionWeight\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Targeted object", + "name": "TargetedObject", + "type": "objectList" + }, + { + "description": "Decision weight", + "name": "DecisionWeight", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Intend to avoid an area with a given center and radius.", + "fullName": "Avoid a position", + "functionType": "Action", + "name": "AvoidPosition", + "sentence": "_PARAM0_ intend to avoid a radius of _PARAM4_ around _PARAM2_; _PARAM3_ (decision weight: _PARAM5_)", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Evaluate at which distance the object will go past a location if it were to continue in its current direction.\n\nspeedUnitX = velocityX / speed\nspeedUnitY = velocityY / speed\n\ndeltaX = centerX - object.CenterX\ndeltaY = centerY - object.CenterY\n\nnormalX = -deltaY;\nnormalY = deltaX;\n\ntrajectoryDistance = speedUnitX * normalX + speedUnitY * normalY", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::SetPropertyTrajectoryDistance" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "(Object.Behavior::VelocityX() * (Object.CenterY() - GetArgumentAsNumber(\"CenterY\")) + Object.Behavior::VelocityY() * (GetArgumentAsNumber(\"CenterX\") - Object.CenterX())) / Object.Behavior::Speed()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "If this distance is smaller than the specified radius, the Boid must try turn in the right direction to avoid the area.", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::PropertyTrajectoryDistance" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "- GetArgumentAsNumber(\"Radius\")" + ] + }, + { + "type": { + "value": "BoidsMovement::BoidsMovement::PropertyTrajectoryDistance" + }, + "parameters": [ + "Object", + "Behavior", + "<", + "GetArgumentAsNumber(\"Radius\")" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "(normalX ; normalY)", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::PropertyTrajectoryDistance" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::MoveInDirection" + }, + "parameters": [ + "Object", + "Behavior", + "-(GetArgumentAsNumber(\"CenterY\") - Object.CenterY())", + "GetArgumentAsNumber(\"CenterX\") - Object.CenterX()", + "GetArgumentAsNumber(\"DecisionWeight\")", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "(-normalX ; -normalY)", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::PropertyTrajectoryDistance" + }, + "parameters": [ + "Object", + "Behavior", + "<", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::MoveInDirection" + }, + "parameters": [ + "Object", + "Behavior", + "GetArgumentAsNumber(\"CenterY\") - Object.CenterY()", + "-(GetArgumentAsNumber(\"CenterX\") - Object.CenterX())", + "GetArgumentAsNumber(\"DecisionWeight\")", + "" + ] + } + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Center X", + "name": "CenterX", + "type": "expression" + }, + { + "description": "Center Y", + "name": "CenterY", + "type": "expression" + }, + { + "description": "Radius", + "name": "Radius", + "type": "expression" + }, + { + "description": "Decision weight", + "name": "DecisionWeight", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Intend to avoid an area from an object center and a given radius.", + "fullName": "Avoid an object", + "functionType": "Action", + "name": "AvoidObject", + "sentence": "_PARAM0_ intend to avoid a radius of _PARAM3_ around _PARAM2_ (decision weight: _PARAM4_)", + "events": [ + { + "type": "BuiltinCommonInstructions::ForEach", + "object": "AvoidedObject", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::AvoidPosition" + }, + "parameters": [ + "Object", + "Behavior", + "AvoidedObject.CenterX()", + "AvoidedObject.CenterY()", + "GetArgumentAsNumber(\"Radius\")", + "GetArgumentAsNumber(\"DecisionWeight\")", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Avoided object", + "name": "AvoidedObject", + "type": "objectList" + }, + { + "description": "Radius", + "name": "Radius", + "type": "expression" + }, + { + "description": "Decision weight", + "name": "DecisionWeight", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Return the current speed.", + "fullName": "Speed", + "functionType": "Expression", + "name": "Speed", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "const behavior = object.getBehavior(behaviorName);", + "const directionX = eventsFunctionContext.getArgument(\"DirectionX\");", + "const directionY = eventsFunctionContext.getArgument(\"DirectionY\");", + "const decisionWeight = eventsFunctionContext.getArgument(\"DecisionWeight\");", + "", + "eventsFunctionContext.returnValue = behavior.__boidsExtension.boid.velocity.magnitude();" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the current vertical speed.", + "fullName": "Velocity Y", + "functionType": "Expression", + "name": "VelocityX", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "const behavior = object.getBehavior(behaviorName);", + "const directionX = eventsFunctionContext.getArgument(\"DirectionX\");", + "const directionY = eventsFunctionContext.getArgument(\"DirectionY\");", + "const decisionWeight = eventsFunctionContext.getArgument(\"DecisionWeight\");", + "", + "eventsFunctionContext.returnValue = behavior.__boidsExtension.boid.velocity.x;" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the current horizontal speed.", + "fullName": "Velocity X", + "functionType": "Expression", + "name": "VelocityY", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "const behavior = object.getBehavior(behaviorName);", + "const directionX = eventsFunctionContext.getArgument(\"DirectionX\");", + "const directionY = eventsFunctionContext.getArgument(\"DirectionY\");", + "const decisionWeight = eventsFunctionContext.getArgument(\"DecisionWeight\");", + "", + "eventsFunctionContext.returnValue = behavior.__boidsExtension.boid.velocity.y;" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Change the maximum speed of the object.", + "fullName": "Maximum speed", + "functionType": "Action", + "group": "Boids movement configuration", + "name": "SetMaxSpeed", + "sentence": "Change the maximum speed of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::SetPropertyMaxSpeed" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"MaxSpeed\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Max Speed", + "name": "MaxSpeed", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Change the maximum acceleration of the object.", + "fullName": "Maximum acceleration", + "functionType": "Action", + "group": "Boids movement configuration", + "name": "SetMaxAcceleration", + "sentence": "Change the maximum acceleration of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::SetPropertyMaxAcceleration" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"SteeringForce\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Steering Force", + "name": "SteeringForce", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the object is rotated while moving on its path.", + "fullName": "Object Rotated", + "functionType": "Condition", + "group": "Boids movement configuration", + "name": "ShouldRotate", + "sentence": "_PARAM0_ is rotated when moving", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::PropertyShouldRotate" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the maximum speed.", + "fullName": "Maximum speed", + "functionType": "Expression", + "group": "Boids movement configuration", + "name": "MaxSpeed", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyMaxSpeed()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the maximum acceleration.", + "fullName": "Maximum acceleration", + "functionType": "Expression", + "group": "Boids movement configuration", + "name": "MaxAcceleration", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyMaxAcceleration()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the cohesion sight radius.", + "fullName": "Cohesion sight radius", + "functionType": "Expression", + "group": "Boids sight configuration", + "name": "CohesionRadius", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyCohesionRadius()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Change the cohesion sight radius.", + "fullName": "Cohesion sight radius", + "functionType": "Action", + "group": "Boids sight configuration", + "name": "SetCohesionRadius", + "sentence": "Change the cohesion sight radius of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::SetPropertyCohesionRadius" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Return the alignment sight radius.", + "fullName": "Alignment sight radius", + "functionType": "Expression", + "group": "Boids sight configuration", + "name": "AlignmentRadius", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyAlignmentRadius()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the alignment sight radius.", + "fullName": "Alignment sight radius", + "functionType": "Action", + "group": "Boids sight configuration", + "name": "SetAlignmentRadius", + "sentence": "Change the alignment sight radius of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::SetPropertyAlignmentRadius" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Return the separation sight radius.", + "fullName": "Separation sight radius", + "functionType": "Expression", + "group": "Boids sight configuration", + "name": "SeparationRadius", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertySeparationRadius()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the separation sight radius.", + "fullName": "Separation sight radius", + "functionType": "Action", + "group": "Boids sight configuration", + "name": "SetSeparationRadius", + "sentence": "Change the separation sight radius of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::SetPropertySeparationRadius" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Return which weight the cohesion takes in the chosen direction.", + "fullName": "Cohesion weight", + "functionType": "Expression", + "group": "Boids decision configuration", + "name": "CohesionWeight", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyCohesionWeight()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Change the weight the cohesion takes in the chosen direction.", + "fullName": "Cohesion weight", + "functionType": "Action", + "group": "Boids decision configuration", + "name": "SetCohesionWeight", + "sentence": "Change the cohesion weight of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::SetPropertyCohesionWeight" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Return which weight the alignment takes in the chosen direction.", + "fullName": "Alignment weight", + "functionType": "Expression", + "group": "Boids decision configuration", + "name": "AlignmentWeight", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyAlignmentWeight()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Change the weight the alignment takes in the chosen direction.", + "fullName": "Alignment weight", + "functionType": "Action", + "group": "Boids decision configuration", + "name": "SetAlignmentWeight", + "sentence": "Change the alignment weight of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::SetPropertyAlignmentWeight" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Return which weight the separation takes in the chosen direction.", + "fullName": "Separation weight", + "functionType": "Expression", + "group": "Boids decision configuration", + "name": "SeparationWeight", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertySeparationWeight()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Change the weight the separation takes in the chosen direction.", + "fullName": "Separation weight", + "functionType": "Action", + "group": "Boids decision configuration", + "name": "SetSeparationWeight", + "sentence": "Change the separation weight of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::SetPropertySeparationWeight" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "360", + "type": "Number", + "label": "Maximum speed (in pixels per second)", + "description": "", + "group": "Movement", + "extraInformation": [], + "hidden": false, + "name": "MaxSpeed" + }, + { + "value": "720", + "type": "Number", + "label": "Maximum acceleration (in pixels per second per second)", + "description": "", + "group": "Movement", + "extraInformation": [], + "hidden": false, + "name": "MaxAcceleration" + }, + { + "value": "true", + "type": "Boolean", + "label": "Rotate object", + "description": "", + "group": "Movement", + "extraInformation": [], + "hidden": false, + "name": "ShouldRotate" + }, + { + "value": "64", + "type": "Number", + "label": "Cohesion sight radius", + "description": "", + "group": "Sight", + "extraInformation": [], + "hidden": false, + "name": "CohesionRadius" + }, + { + "value": "48", + "type": "Number", + "label": "Alignement sight radius", + "description": "", + "group": "Sight", + "extraInformation": [], + "hidden": false, + "name": "AlignmentRadius" + }, + { + "value": "32", + "type": "Number", + "label": "Separation sight radius", + "description": "", + "group": "Sight", + "extraInformation": [], + "hidden": false, + "name": "SeparationRadius" + }, + { + "value": "1", + "type": "Number", + "label": "Cohesion decision weight", + "description": "", + "group": "Decision", + "extraInformation": [], + "hidden": false, + "name": "CohesionWeight" + }, + { + "value": "1", + "type": "Number", + "label": "Alignment decision weight", + "description": "", + "group": "Decision", + "extraInformation": [], + "hidden": false, + "name": "AlignmentWeight" + }, + { + "value": "2", + "type": "Number", + "label": "Separation decision weight", + "description": "", + "group": "Decision", + "extraInformation": [], + "hidden": false, + "name": "SeparationWeight" + }, + { + "value": "", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "TrajectoryDistance" + } + ], + "sharedPropertyDescriptors": [] + } + ], + "eventsBasedObjects": [] + }, + { + "author": "@4ian, Tristan Rhodes (https://victrisgames.itch.io/)", + "category": "Movement", + "extensionNamespace": "", + "fullName": "Ellipse movement", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXNpbmUtd2F2ZSIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0xNi41LDIxQzEzLjUsMjEgMTIuMzEsMTYuNzYgMTEuMDUsMTIuMjhDMTAuMTQsOS4wNCA5LDUgNy41LDVDNC4xMSw1IDQsMTEuOTMgNCwxMkgyQzIsMTEuNjMgMi4wNiwzIDcuNSwzQzEwLjUsMyAxMS43MSw3LjI1IDEyLjk3LDExLjc0QzEzLjgzLDE0LjggMTUsMTkgMTYuNSwxOUMxOS45NCwxOSAyMC4wMywxMi4wNyAyMC4wMywxMkgyMi4wM0MyMi4wMywxMi4zNyAyMS45NywyMSAxNi41LDIxWiIgLz48L3N2Zz4=", + "name": "EllipseMovement", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/sine-wave.svg", + "shortDescription": "Move objects on ellipses or smoothly back and forth in one direction.", + "version": "1.0.0", + "description": [ + "It allows objects to move:", + "- on an ellipsis or arcs", + "- smoothly vertically or horizontally (by setting one radius to 0)", + "- on a sine wave (by adding a force)", + "", + "It can be used for:", + "- Making objects float, such as powerups or coins", + "- Moving platforms", + "- Enemy movement patterns", + "- Making a player constantly turn right or left ([open the project online](https://editor.gdevelop.io/?project=example://star-seeker))" + ], + "origin": { + "identifier": "EllipseMovement", + "name": "gdevelop-extension-store" + }, + "tags": [ + "sine", + "ellipse", + "movement", + "circular", + "circle", + "floating", + "platform", + "enemy" + ], + "authorIds": [ + "wWP8BSlAW0UP4NeaHa2LcmmDzmH2", + "gqDaZjCfevOOxBYkK6zlhtZnXCg1", + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" + ], + "dependencies": [], + "eventsFunctions": [], + "eventsBasedBehaviors": [ + { + "description": "Move objects on ellipses or smoothly back and forth in one direction.", + "fullName": "Ellipse movement", + "name": "EllipseMovement", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyOldX" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.X()" + ] + }, + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyOldY" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.Y()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Evaluate the center of movement from the object position and properties.", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::PropertyInitialTurningLeft" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyLoopDuration" + }, + "parameters": [ + "Object", + "Behavior", + "*", + "-1" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::PropertyLoopDuration" + }, + "parameters": [ + "Object", + "Behavior", + "<", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyMovementAngle" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.Behavior::PropertyInitialDirectionAngle() + 90" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::PropertyLoopDuration" + }, + "parameters": [ + "Object", + "Behavior", + ">=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyMovementAngle" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.Behavior::PropertyInitialDirectionAngle() - 90" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyCenterX" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.X() - Object.Behavior::DeltaX()" + ] + }, + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyCenterY" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.Y() - Object.Behavior::DeltaY()" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Update the center when the object is moved outside of the behavior.", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyCenterX" + }, + "parameters": [ + "Object", + "Behavior", + "+", + "Object.X() - Object.Behavior::PropertyOldX()" + ] + }, + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyCenterY" + }, + "parameters": [ + "Object", + "Behavior", + "+", + "Object.Y() - Object.Behavior::PropertyOldY()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Place the object according to the movement angle.", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::PropertyRadiusX" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Object", + "=", + "Object.Behavior::PropertyCenterX() + Object.Behavior::DeltaX()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::PropertyRadiusY" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Object", + "=", + "Object.Behavior::PropertyCenterY() + Object.Behavior::DeltaY()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::PropertyShouldRotate" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetAngle" + }, + "parameters": [ + "Object", + "=", + "Object.Behavior::DirectionAngle() + Object.Behavior::PropertyRotationOffset()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Save the position to detect when the object is moved outside of the behavior.", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyOldX" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.X()" + ] + }, + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyOldY" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.Y()" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPostEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Update the movement angle for the next frame.", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyMovementAngle" + }, + "parameters": [ + "Object", + "Behavior", + "+", + "360 * TimeDelta() / Object.Behavior::PropertyLoopDuration()" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Change the turning direction (left or right).", + "fullName": "Turn the other way", + "functionType": "Action", + "name": "ToggleTurningLeft", + "sentence": "_PARAM0_ turn the other way", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyCenterX" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "2 * Object.X() - Object.Behavior::CenterX()" + ] + }, + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyCenterY" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "2 * Object.Y() - Object.Behavior::CenterY()" + ] + }, + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyMovementAngle" + }, + "parameters": [ + "Object", + "Behavior", + "+", + "180" + ] + }, + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyLoopDuration" + }, + "parameters": [ + "Object", + "Behavior", + "*", + "-1" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Change the in which side the object is turning (left or right).", + "fullName": "Turn left or right", + "functionType": "Action", + "name": "SetTurningLeft", + "sentence": "_PARAM0_ turn left: _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "BuiltinCommonInstructions::And" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::IsTurningLeft" + }, + "parameters": [ + "Object", + "Behavior", + "yes", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"TurnLeft\"" + ] + } + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::And" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "inverted": true, + "value": "EllipseMovement::EllipseMovement::IsTurningLeft" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"TurnLeft\"" + ] + } + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::ToggleTurningLeft" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + }, + { + "description": "Turn left", + "name": "TurnLeft", + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the object is turning left.", + "fullName": "Is turning left", + "functionType": "Condition", + "name": "IsTurningLeft", + "sentence": "_PARAM0_ is turning left", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::PropertyLoopDuration" + }, + "parameters": [ + "Object", + "Behavior", + "<", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the movement angle of the object.", + "fullName": "Movement angle", + "functionType": "Expression", + "name": "MovementAngle", + "sentence": "Set initial Y of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyMovementAngle()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the loop duration (in seconds).", + "fullName": "Loop duration", + "functionType": "Expression", + "group": "Configuration", + "name": "LoopDuration", + "sentence": "Set initial Y of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "abs(Object.Behavior::PropertyLoopDuration())" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the ellipse radius on X axis.", + "fullName": "Radius X", + "functionType": "Expression", + "group": "Configuration", + "name": "RadiusX", + "sentence": "Set initial Y of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyRadiusX()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the ellipse radius on X axis.", + "fullName": "Radius Y", + "functionType": "Expression", + "group": "Configuration", + "name": "RadiusY", + "sentence": "Set initial Y of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyRadiusY()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the movement center position on X axis.", + "fullName": "Movement center X", + "functionType": "Expression", + "group": "Configuration", + "name": "CenterX", + "sentence": "Set initial Y of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyCenterX()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the movement center position on Y axis.", + "fullName": "Movement center Y", + "functionType": "Expression", + "group": "Configuration", + "name": "CenterY", + "sentence": "Set initial Y of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyCenterY()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Change the radius on X axis of the movement.", + "fullName": "Radius X", + "functionType": "Action", + "group": "Elliptical movement configuration", + "name": "SetRadiusX", + "sentence": "Change the radius on X axis of the movement of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyRadiusX" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + }, + { + "description": "Radius X", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Change the radius on Y axis of the movement.", + "fullName": "Radius Y", + "functionType": "Action", + "group": "Elliptical movement configuration", + "name": "SetRadiusY", + "sentence": "Change the radius on Y axis of the movement of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyRadiusY" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + }, + { + "description": "Radius Y", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Change the loop duration.", + "fullName": "Loop duration", + "functionType": "Action", + "group": "Elliptical movement configuration", + "name": "SetLoopDuration", + "sentence": "Change the loop duration of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::IsTurningLeft" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyLoopDuration" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "-GetArgumentAsNumber(\"Value\")" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "EllipseMovement::EllipseMovement::IsTurningLeft" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyLoopDuration" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + }, + { + "description": "Speed (in degrees per second)", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Change the movement angle. The object is teleported according to the angle.", + "fullName": "Teleport at an angle", + "functionType": "Action", + "name": "SetMovementAngle", + "sentence": "Teleport _PARAM0_ on the ellipse at _PARAM2_°", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyMovementAngle" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + }, + { + "description": "Movement angle", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "fullName": "Delta X", + "functionType": "Expression", + "name": "DeltaX", + "private": true, + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "cos(ToRad(Object.Behavior::PropertyMovementAngle())) * Object.Behavior::PropertyRadiusX()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "Delta Y", + "functionType": "Expression", + "name": "DeltaY", + "private": true, + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "sin(ToRad(Object.Behavior::PropertyMovementAngle())) * Object.Behavior::PropertyRadiusY()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "Direction angle", + "functionType": "Expression", + "name": "DirectionAngle", + "private": true, + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::PropertyLoopDuration" + }, + "parameters": [ + "Object", + "Behavior", + "<", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyMovementAngle() + 90" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::PropertyLoopDuration" + }, + "parameters": [ + "Object", + "Behavior", + ">=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyMovementAngle() - 90" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "100", + "type": "Number", + "label": "Radius of the movement on X axis (0 to deactivate)", + "description": "", + "group": "Ellipse", + "extraInformation": [], + "hidden": false, + "name": "RadiusX" + }, + { + "value": "0", + "type": "Number", + "label": "Radius of the movement on Y axis (0 to deactivate)", + "description": "", + "group": "Ellipse", + "extraInformation": [], + "hidden": false, + "name": "RadiusY" + }, + { + "value": "6", + "type": "Number", + "label": "Loop duration (in seconds)", + "description": "", + "group": "Speed", + "extraInformation": [], + "hidden": false, + "name": "LoopDuration" + }, + { + "value": "", + "type": "Boolean", + "label": "Turn left", + "description": "", + "group": "Speed", + "extraInformation": [], + "hidden": false, + "name": "InitialTurningLeft" + }, + { + "value": "", + "type": "Number", + "label": "Initial direction (in degree)", + "description": "", + "group": "Speed", + "extraInformation": [], + "hidden": false, + "name": "InitialDirectionAngle" + }, + { + "value": "", + "type": "Boolean", + "label": "Rotate", + "description": "", + "group": "Rotation", + "extraInformation": [], + "hidden": false, + "name": "ShouldRotate" + }, + { + "value": "0", + "type": "Number", + "label": "Rotation offset (in degree)", + "description": "", + "group": "Rotation", + "extraInformation": [], + "hidden": false, + "name": "RotationOffset" + }, + { + "value": "0", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "CenterX" + }, + { + "value": "0", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "CenterY" + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "CollisionDetector::IsAroundRectangle" - }, - "parameters": [ - "", - "Obstacle", - "Obstacle", - "640", - "0", - "1280", - "720", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "DebuggerTools::ConsoleLog" - }, - "parameters": [ - "\"Brown: \" + ToString(PickedInstancesCount(BigBrownMeteor1))", - "", - "" - ] - }, - { - "type": { - "value": "DebuggerTools::ConsoleLog" - }, - "parameters": [ - "\"Grey: \" + ToString(PickedInstancesCount(BigGreyMeteor2))", - "", - "" - ] - } - ] - } - ] - } - ], - "layers": [ - { - "ambientLightColorB": 0, - "ambientLightColorG": 9943112, - "ambientLightColorR": 16, - "followBaseLayerCamera": false, - "isLightingLayer": false, - "name": "", - "visibility": true, - "cameras": [ + "value": "0", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "MovementAngle" + }, { - "defaultSize": true, - "defaultViewport": true, - "height": 0, - "viewportBottom": 1, - "viewportLeft": 0, - "viewportRight": 1, - "viewportTop": 0, - "width": 0 + "value": "", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "OldX" + }, + { + "value": "", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "OldY" } ], - "effects": [] + "sharedPropertyDescriptors": [] } ], - "behaviorsSharedData": [ - { - "name": "Obstacle", - "type": "CollisionDetector::Solid" - } - ] - } - ], - "externalEvents": [], - "eventsFunctionsExtensions": [ + "eventsBasedObjects": [] + }, { "author": "Tristan Rhodes (tristan@victrisgames.com), Entropy", "category": "Movement", @@ -5198,9 +10033,6 @@ "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "\r", - "runtimeScene.__collisionDetectorExtension = runtimeScene.__collisionDetectorExtension || {};\r", - "runtimeScene.__collisionDetectorExtension.solidManager =\r", - " runtimeScene.__collisionDetectorExtension.solidManager || new gdjs.__collisionDetectorExtension.SolidManager();\r", "const manager = runtimeScene.__collisionDetectorExtension.solidManager;\r", "\r", "const solidObjectsLists = eventsFunctionContext.getObjectsLists(\"Object\");\r", @@ -5281,9 +10113,6 @@ "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "\r", - "runtimeScene.__collisionDetectorExtension = runtimeScene.__collisionDetectorExtension || {};\r", - "runtimeScene.__collisionDetectorExtension.solidManager =\r", - " runtimeScene.__collisionDetectorExtension.solidManager || new gdjs.__collisionDetectorExtension.SolidManager();\r", "const manager = runtimeScene.__collisionDetectorExtension.solidManager;\r", "\r", "const objects = eventsFunctionContext.getObjects(\"Object\");\r", @@ -5326,7 +10155,204 @@ " object.separateFromObjects(pickedObjects);\r", " }\r", " }\r", - "}" + "}" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "objectList" + }, + { + "description": "Solid behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + }, + { + "description": "Object (won't move)", + "name": "OtherObject", + "type": "objectList" + }, + { + "description": "Solid behavior", + "name": "OtherBehavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "Is on screen", + "functionType": "Condition", + "name": "IsOnScreen", + "sentence": "_PARAM1_ is on screen", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "\r", + "const solidObjectsLists = eventsFunctionContext.getObjectsLists(\"Object\");\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "\r", + "for (const solidObjectName in solidObjectsLists.items) {\r", + " const pickedObjects = solidObjectsLists.items[solidObjectName];\r", + "\r", + " const sharedData = pickedObjects[0].getBehavior(behaviorName)._sharedData;\r", + "\r", + " /** @type {gdjs.RuntimeObject[]} */\r", + " const onScreenObjects = sharedData.onScreenObjects;\r", + "\r", + " if (pickedObjects.length === runtimeScene.getInstancesCountOnScene(solidObjectName)) {\r", + " pickedObjects.length = 0;\r", + " pickedObjects.push.apply(pickedObjects, onScreenObjects);\r", + " }\r", + " else {\r", + " // TODO\r", + " console.error(\"The 'is on screen' condition must be used first.\");\r", + " pickedObjects.length = 0;\r", + " pickedObjects.push.apply(pickedObjects, onScreenObjects);\r", + " }\r", + "}\r", + "\r", + "eventsFunctionContext.returnValue = true;" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "objectList" + }, + { + "description": "On screen detector behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::OnScreenDetector", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "Has left screen", + "functionType": "Condition", + "name": "HasLeftScreen", + "sentence": "_PARAM1_ has left screen", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "\r", + "const solidObjectsLists = eventsFunctionContext.getObjectsLists(\"Object\");\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "\r", + "for (const solidObjectName in solidObjectsLists.items) {\r", + " const pickedObjects = solidObjectsLists.items[solidObjectName];\r", + "\r", + " const sharedData = pickedObjects[0].getBehavior(behaviorName)._sharedData;\r", + "\r", + " /** @type {gdjs.RuntimeObject[]} */\r", + " const previousOnScreenObjects = sharedData.previousOnScreenObjects;\r", + " /** @type {gdjs.RuntimeObject[]} */\r", + " const onScreenObjects = sharedData.onScreenObjects;\r", + "\r", + " if (pickedObjects.length === runtimeScene.getInstancesCountOnScene(solidObjectName)) {\r", + " pickedObjects.length = 0;\r", + " previousOnScreenObjects.forEach(previousOnScreenObject => {\r", + " if (!onScreenObjects.includes(previousOnScreenObject)) {\r", + " pickedObjects.push(previousOnScreenObject);\r", + " }\r", + " });\r", + " }\r", + " else {\r", + " // TODO\r", + " console.error(\"The 'has left screen' condition must be used first.\");\r", + " pickedObjects.length = 0;\r", + " previousOnScreenObjects.forEach(previousOnScreenObject => {\r", + " if (!onScreenObjects.includes(previousOnScreenObject)) {\r", + " pickedObjects.push(previousOnScreenObject);\r", + " }\r", + " });\r", + " }\r", + "}\r", + "\r", + "eventsFunctionContext.returnValue = true;" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "objectList" + }, + { + "description": "On screen detector behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::OnScreenDetector", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "Will enter screen", + "functionType": "Condition", + "name": "WillEnterScreen", + "sentence": "_PARAM1_ will enter screen", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "\r", + "const solidObjectsLists = eventsFunctionContext.getObjectsLists(\"Object\");\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "\r", + "for (const solidObjectName in solidObjectsLists.items) {\r", + " const pickedObjects = solidObjectsLists.items[solidObjectName];\r", + "\r", + " const sharedData = pickedObjects[0].getBehavior(behaviorName)._sharedData;\r", + "\r", + " /** @type {gdjs.RuntimeObject[]} */\r", + " const previousOnScreenObjects = sharedData.previousOnScreenObjects;\r", + " /** @type {gdjs.RuntimeObject[]} */\r", + " const onScreenObjects = sharedData.onScreenObjects;\r", + " //console.log(\"In: \" + previousOnScreenObjects.length + \" --> \" + onScreenObjects.length);\r", + "\r", + " if (pickedObjects.length === runtimeScene.getInstancesCountOnScene(solidObjectName)) {\r", + " pickedObjects.length = 0;\r", + " onScreenObjects.forEach(onScreenObject => {\r", + " if (!previousOnScreenObjects.includes(onScreenObject)) {\r", + " pickedObjects.push(onScreenObject);\r", + " }\r", + " });\r", + " }\r", + " else {\r", + " // TODO\r", + " console.error(\"The 'will enter screen' condition must be used first.\");\r", + " pickedObjects.length = 0;\r", + " onScreenObjects.forEach(onScreenObject => {\r", + " if (!previousOnScreenObjects.includes(onScreenObject)) {\r", + " pickedObjects.push(onScreenObject);\r", + " }\r", + " });\r", + " }\r", + "}\r", + "\r", + "eventsFunctionContext.returnValue = true;" ], "parameterObjects": "", "useStrict": true, @@ -5340,20 +10366,9 @@ "type": "objectList" }, { - "description": "Solid behavior", + "description": "On screen detector behavior", "name": "Behavior", - "supplementaryInformation": "CollisionDetector::Solid", - "type": "behavior" - }, - { - "description": "Object (won't move)", - "name": "OtherObject", - "type": "objectList" - }, - { - "description": "Solid behavior", - "name": "OtherBehavior", - "supplementaryInformation": "CollisionDetector::Solid", + "supplementaryInformation": "CollisionDetector::OnScreenDetector", "type": "behavior" } ], @@ -5939,6 +10954,294 @@ } ], "sharedPropertyDescriptors": [] + }, + { + "description": "", + "fullName": "", + "name": "OnScreenDetector", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "const sharedData = objects[0].getBehavior(behaviorName)._sharedData;\r", + "\r", + "sharedData.onScreenObjects = sharedData.onScreenObjects || [];\r", + "sharedData.previousOnScreenObjects = sharedData.previousOnScreenObjects || [];\r", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::OnScreenDetector", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "CollisionDetector::OnScreenDetector::SharedPropertyHasCheckObjectsThisFrame" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [ + { + "type": { + "value": "CollisionDetector::OnScreenDetector::SetSharedPropertyHasCheckObjectsThisFrame" + }, + "parameters": [ + "Object", + "Behavior", + "yes" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "CollisionDetector::OnScreenDetector::SharedPropertyPreviousCameraX" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "floor(CameraCenterX(Object.Behavior::SharedPropertyLayer()) / Object.Behavior::SharedPropertySnapSize()) * Object.Behavior::SharedPropertySnapSize()" + ] + }, + { + "type": { + "value": "CollisionDetector::OnScreenDetector::SharedPropertyPreviousCameraY" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "floor(CameraCenterY(Object.Behavior::SharedPropertyLayer()) / Object.Behavior::SharedPropertySnapSize()) * Object.Behavior::SharedPropertySnapSize()" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "CollisionDetector::OnScreenDetector::SetSharedPropertyPreviousCameraX" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "floor(CameraCenterX(Object.Behavior::SharedPropertyLayer()) / Object.Behavior::SharedPropertySnapSize()) * Object.Behavior::SharedPropertySnapSize()" + ] + }, + { + "type": { + "value": "CollisionDetector::OnScreenDetector::SetSharedPropertyPreviousCameraY" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "floor(CameraCenterY(Object.Behavior::SharedPropertyLayer()) / Object.Behavior::SharedPropertySnapSize()) * Object.Behavior::SharedPropertySnapSize()" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "const sharedData = object.getBehavior(behaviorName)._sharedData;\r", + "\r", + "const layerName = sharedData._getLayer();\r", + "const left = gdjs.evtTools.camera.getCameraBorderLeft(runtimeScene, layerName);\r", + "const top = gdjs.evtTools.camera.getCameraBorderTop(runtimeScene, layerName);\r", + "const right = gdjs.evtTools.camera.getCameraBorderRight(runtimeScene, layerName);\r", + "const bottom = gdjs.evtTools.camera.getCameraBorderBottom(runtimeScene, layerName);\r", + "\r", + "const previousOnScreenObjects = sharedData.onScreenObjects;\r", + "sharedData.onScreenObjects = sharedData.previousOnScreenObjects;\r", + "sharedData.previousOnScreenObjects = previousOnScreenObjects;\r", + "\r", + "const onScreenObjects = sharedData.onScreenObjects;\r", + "onScreenObjects.length = 0;\r", + "const manager = runtimeScene.__collisionDetectorExtension.solidManager;\r", + "manager.getAllInstancesInRectangle(runtimeScene, object.getName(), left, top, right, bottom, onScreenObjects);\r", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::OnScreenDetector", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPostEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CollisionDetector::OnScreenDetector::SetSharedPropertyHasCheckObjectsThisFrame" + }, + "parameters": [ + "Object", + "Behavior", + "=" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::OnScreenDetector", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "Solid behavior", + "description": "", + "group": "", + "extraInformation": [ + "CollisionDetector::Solid" + ], + "hidden": false, + "name": "SolidBehavior" + } + ], + "sharedPropertyDescriptors": [ + { + "value": "", + "type": "Boolean", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "HasCheckObjectsThisFrame" + }, + { + "value": "", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "PreviousCameraX" + }, + { + "value": "", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "PreviousCameraY" + }, + { + "value": "128", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "SnapSize" + }, + { + "value": "", + "type": "String", + "label": "Layer", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "Layer" + } + ] } ], "eventsBasedObjects": [] From 934977251759753b370479cb57d08e9e3d53ac0d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 31 Dec 2022 23:00:51 +0000 Subject: [PATCH 11/11] Optimised images with calibre/image-actions --- examples/rtree/assets/Green Ufo.png | Bin 3049 -> 3013 bytes .../rtree/assets/tiled_dark purple space.png | Bin 2880 -> 1838 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/examples/rtree/assets/Green Ufo.png b/examples/rtree/assets/Green Ufo.png index 7d441b2c5ff5f42d6ea61ad9503fb3f237f925f4..8348d2a526954486f5fabdc1270756f145c856cd 100644 GIT binary patch delta 40 tcmaDUepGydvM>W@fk$L90|U1Z2s2)~TlZ(9VjDLngQu&X%Q~loCIIQZ3-SN} delta 77 zcmX>q{!)B`@RnI7=Xaj)z4*}Q$iB}STY-f diff --git a/examples/rtree/assets/tiled_dark purple space.png b/examples/rtree/assets/tiled_dark purple space.png index d9c3fd42dc38bbc1e9fa407a0790598114f1e5d6..dba417ad31dceed4d14ce193f7ce16f379f7996f 100644 GIT binary patch literal 1838 zcma)-X;72r7RR4AVF@7cM#WYZ3Aj*Pf?nAgAVeDr)Iw0f-~s`c3YY+uf(RtMR7G}L zwIhN+O0g7V6HzIUrC^IAj0M?bNr3c*2m~V}7YHHbMminaJH2=AhiA_De|YB1bI$qy zo(z9KFJnVwgazjm zUi)W-Wprlu_GHlsy8@7SfLJx%JY%Es_boW}g{RB_d74JbTDjmMP}OH#G=X!~T)K#} z#@r9ZrH^3Ht7S0!quN>k1{m?fP}(rrdbDTEK&c2o5<5pfHPU%Brh5R7B=TuY#x zY(-Pd;%GVV>gg+BP3oy1C)TBTh!c*CdQ_D+3q;DG7WZwG!pZR!!D(g)!}$(8QS>q# zHAb^*>v{I9uk09am?4o}oRq7U7bJ6e<>K~_=EraTB=x5}8rMwz5^)5a?CLZbU-Omm z_K$F)J7{SqlumUL(j{Kh)bs%2$?9^|WR67`+1@H3tbh6tM#TB}PF^Gg$D$AZK81I! zcvGNcL~X|4rp_7Cbs%zNeBrL;xgao`o052m@IwpY4Z5us+qyiZ>hU)vMJZlxGPCg; zx0MKJ;w_ZW2keL8Q%dqZed zI}%3j{@T8Lx9v|CUG-nyM#IrS5JH8alU*}$x>&yM@1hCcJNZ@)IF4o7VfBIMGpVy` z$;}VNKHrLIv5eLsCAY80n?I0uNA4YVSP~Cpx9O5D?$kT$I)9C$$>%vr^keYC95YbV z!KS5gM&a~u2{;%FN{bDW)v@6yKJ#5y`KDa9JrKnm_g6kM#vuK~zB_hmv8bUT0S`*u z(TdFTyi>=(`>51=r2p8`WS0UL>51>MEcw_9Fdfx@=v*EohWEK)*MLGR81W7EzmRA-SoLOf@9q)ha0Tf2*wp_x2-UU zevkB0CJ(bRclFo`o5SF~vSGmjg{`2pvmkgjknLQZwHb`)BQ7oLq=zv7CpDH&+!K0V z2Eu}GI?`Q`K}LV&!S~6RYm|JYYQ@em*LDAz4t$eid6&I`Xbb z+w3n7ep^g$>kI;@^!!|&M4C22@Luno+08CG@&;vn*N>zY=d(8S+9 z&IhG8O)7U!KeW<;D|+I-J;cxgU_#Gb-{$W&=Pz)sB{*2suLpZ(6eXM_+etHVBNkwl zDyIqwO;lSjNc3>9vIR|^V+L+ag6ppJ*G;K?jf0)@S^|8?$yC@pT6kfAJ6ys`!7pEY zsWMJY{~V(jungS{MCKSK(I$63r{ymmeY?M1J}Ictg*|7s$V_%?KS1Dfz>i$BKlICg E1NiC+Q2+n{ literal 2880 zcmaJ@dt4J&7QP8SkbxznzJN$Zh?qx{kt7tG5d>e0 zv`Psgg8f-Qw*@TajhYAwtw^C8D@q6;il73DVR=J#f?&7(Ej$0*d+wa`opaCqzB_Yb zTY#^H*=jQYfQ8>??;rp$=oAA?vFM<&Vv^9o8r~EN2MhPZQjQn`o?PKR2-j)l@=-F6F5d6f{ZUhqXD2ZWg<>w3sWv$G@W;V6*{ zV2;dDAo*|(!5fl9ig_ZKClug}h@5@GLofr6R{CZOe9>E2fn>H#Xv2syj)+JiI2pGz z=jiYM|6Td~x84#s2>PSm{|PJ!k&7T=5F`;E5=Wv3xBo+9DiMt>hB&ZL93m7Roa^GY zXdx_=L<>bYHXHZx4xWH3luFjmxcmFl`~(u1BZ!3jycu{DfWYH%X%uI)F`KCFRI0ZV ziL{AK^>p@Ov&oyh+$dysCs&ubSZ`tEAwDF4=VG~k#CpyfYh(gngl6`J#JpID>mwHO zaWgxn@#e3^ZCYGY$jwJ?rNiQ4wYWu4!Jxb- z^~k9SFe95&$9IV-Kh`i6(=AKm-d}@V0I&dq02aU@ji&v~UNW+(>#Ie9lnaZjyr_Ma z*$1b!bxo%lDiy2hU2KPowiM(((ZHXS%DSFKE{a}f7`9I?TTn%Z9a+9)*2ZqTEx+35 zQzyr!FZ7(ZEy5fqsMjnGr05#KO8z2K`D?D`nR)YF`7l=_1UO&?OaYo6O+7cAtz;gv zGl?cFz=3hPZ!-0kCm34I+EaFJIkNsnhczy@Wntgy@_ArKvdMcr>?ovqtA3o)~kgJ&3PmTMu~NV zVsquWp6*cp(y~ES(oe}?^z|N5Y}V_(6_1T!#Q4ghPSHq2^^7sueIuc$ zthxwSh$(z9d?O*_?Xd9bGb2ok!x0Ml8e6eKjb^*$s(xRKCLya^TspBx&oZygJlRvw z`7q%5THCrr(EGAY^-jZ@(d5sW1IJwQibg}yoA^Jj;rG2fcGzaBXr!ZbRi2y{VAr|> z)0`yFZcWv|2QC>#%2hkDzg^n(VoI8~1i9hRkv#rf$}vM48$tE>tE%uB%FYNU;xmCL zW^=}=?D_Q0BjH9*FomBe9b>C_&r>N$SGwNzbtL|lP$GceQ#-a! z*%yr>G^#zVSgQCHVe<+XS!bbM>M>-aF1~bLM}I~^BHRKgd|7Xs;$fr2kfEb%Ypx8$ zx2GyMnjB57mghZ+pEzyk--Yv0wp@E+eK9TGL0T=J9-G#+7*05*QO1>PM8Q9lR=mIv zosm<%eNP{5_h?vgeEow3r&rpkFG=-qt!3D#tJ*hp@kb||}nC2ImUqI!FBR*~d_`YRMlY#Wzx7pzz?`+=_oTImYmki3U zVLc3{j~=thV9n)Ile{G%pPsY(x9&4CAcomYeLrsdwKZbXvwa4S?Ehzd&R%qLa-B6pwJM5f_Gy#Q-w&TyrY`VRgie{`{*IyZ!1uOc{3Oap z<)2hvNwFIcx%Dae^43=;*P8R_9jRYdGP|D-1Y7S0k6i-ma;-a;?5cQjRa+3dBKkyL z+7AhLLC4nX3gR98Q+jaN%Q4qFms{T+ZcJ@GZ%tMwlClcMgw&-IX~|c~CZ-n~K&vZa z|CN37S;Db9Rof>UknsET!AVKSeuR2$Y`QT^a-}k@&GxRGP+C&I=zB07&i|mG_n-8m z4eM0}6PkUYamPu0mi_pPDU)*Rp&KSNq}mtZ zhS6@99CQB`pyO@15Ze{5U9o&W5O6c|V=cC&D9Egw^ludBqB<5>vFf*6y!O+A<*a=4 z@`IGBLQK_O>^IlWA6|Lay!ns`!T8bmOE3Rqs%vY+Eu-iM!ln16F2OCi!Y+IXlAS#& z8@ZRCk<6k01C`Rf4tghhkU@~8H;U8y#a<`byC+L-8V(rtPF&z+r)nk&%PuctNe>iM zKHYvZOL<