IntelliTiles Platformer Engine
@Stage\n\n@player\n\ndefine hitbox\nswitch costume to (hitbox v)\nchange [yvel v] by (-1)\nif <(yvel) < [-30]> then\n    set [yvel v] to [-30]\nend\nchange y by (yvel)\nif <touching (level hitbox v)?> then\n    if <(yvel) < [0]> then\n        repeat until <not <touching (level hitbox v)?>>\n            change y by (1)\n        end\n    else\n        repeat until <not <touching (level hitbox v)?>>\n            change y by (-1)\n        end\n    end\n    set [yvel v] to [0]\nend\nchange x by (xvel)\nif <touching (level hitbox v)?> then\n    if <(xvel) < [0]> then\n        repeat until <not <touching (level hitbox v)?>>\n            change x by (1)\n        end\n    else\n        repeat until <not <touching (level hitbox v)?>>\n            change x by (-1)\n        end\n    end\n    set [xvel v] to [0]\nend\n\ndefine jump\nswitch costume to (jumpbox v)\nif <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n    if <touching (level hitbox v)?> then\n        set [yvel v] to [14]\n    end\nend\n\nwhen I receive [play v]\ngo to x: (0) y: (60)\nforever\n    if <(editing?) = [0]> then\n        show\n        set [xvel v] to ((xvel) * (.66))\n        change [xvel v] by ((1.5) * (<<key (d v) pressed?> or <key (right arrow v) pressed?>> - <<key (a v) pressed?> or <key (left arrow v) pressed?>>))\n        hitbox\n        jump\n        switch costume to (player v)\n        if <<<key (a v) pressed?> or <key (left arrow v) pressed?>> or <<key (d v) pressed?> or <key (right arrow v) pressed?>>> then\n            if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n                point in direction (90)\n            else\n                point in direction (-90)\n            end\n        end\n        check for edge\n    else\n        hide\n    end\nend\n\ndefine check for edge\nif <(x position) < [-239]> then\n    set x to (238)\n    change [level x v] by (-1)\n    broadcast (update level v) and wait\nelse\n    if <[239] < (x position)> then\n        set x to (-238)\n        change [level x v] by (1)\n        broadcast (update level v) and wait\n    end\nend\nif <(y position) < [-179]> then\n    set y to (178)\n    change [level y v] by (-1)\n    broadcast (update level v) and wait\nelse\n    if <[179] < (y position)> then\n        set y to (-178)\n        change [level y v] by (1)\n        broadcast (update level v) and wait\n    end\nend\n\nwhen flag clicked\nerase all\nbroadcast (update level v) and wait\nbroadcast (play v) and wait\n\n@tiles\n\ndefine stamp level\nset [index v] to [0]\ngo to x: (-230) y: (170)\nswitch costume to (rock v)\nset size to ((20) / (.16)) %\nclear graphic effects\nrepeat (18)\n    set x to (-230)\n    repeat (24)\n        change [index v] by (1)\n        switch costume to (item (index) of [current level v])\n        stamp\n        change x by (20)\n    end\n    change y by (-20)\nend\n\nwhen I receive [update level v]\nerase all\nread level\nstamp level\nbroadcast (hitboxes v) and wait\n\nwhen I receive [refresh level v]\nerase all\nsave level\nstamp level\nbroadcast (hitboxes v) and wait\n\ndefine read level\nset [world index* v] to ((level x) + ((level y) * (100)))\nset [level data v] to (item (WORLD INDEX*) of [world* v])\nset [i v] to [1]\ndelete all of [current level v]\nrepeat until <(letter (i) of (level data)) = []>\n    add (item # of (letter (i) of (level data)) in [encoding vals* v]) to [current level v]\n    change [i v] by (1)\nend\n\ndefine save level\nset [i v] to [1]\nset [level data v] to []\nset [world index* v] to ((level x) + ((level y) * (100)))\nrepeat until <(item (i) of [current level v]) = []>\n    set [level data v] to (join (level data) (item (item (i) of [current level v]) of [encoding vals* v]))\n    change [i v] by (1)\nend\nreplace item (WORLD INDEX*) of [world* v] with (level data)\n\nset [level x v] to [50]\nset [level y v] to [25]\ndelete all of [world* v]\nrepeat (50)\n    repeat (100)\n        add (level data) to [world* v]\n    end\nend\n\nwhen flag clicked\ndelete all of [nonsolid blocks v]\nadd [1] to [nonsolid blocks v]\nadd [3] to [nonsolid blocks v]\n\nwhen flag clicked\nforever\n    switch costume to ([tile type v] of [level editor v])\nend\n\nwhen flag clicked\nset [level x v] to [50]\nset [level y v] to [25]\n\n@level editor\n\nwhen [m v] key pressed\nif <(username) = (username)> then\n    show variable [tile type v]\n    show variable [editor info v]\n    show variable [editor block type v]\n    set [editing? v] to [1]\n    show\n    forever\n        go to (mouse-pointer v)\n        go to x: (((round (((x position) - (10)) / (20))) + (.5)) * (20)) y: (((round (((y position) - (10)) / (20))) + (.5)) * (20))\n        go to [front v] layer\n        set [editor block type v] to (join [Tile: ] ([costume name v] of [tiles v]))\n    end\nend\n\nwhen flag clicked\nset [editor info v] to [1 = single tile, 4 = fill]\nset [editing? v] to [0]\nhide variable [tile type v]\nhide variable [editor info v]\nhide variable [editor block type v]\nhide\n\ndefine fill terrain with range (r)\ndelete all of [fill buffer* v]\nrepeat (432)\n    add [0] to [fill buffer* v]\nend\nreplace item (selection index) of [current level v] with (tile type)\nadd (selection index) to [buffer* v]\nreplace item (selection index) of [fill buffer* v] with (r)\nrepeat until <(length of [buffer* v]) = [0]>\n    set [selection index v] to (item (1) of [buffer* v])\n    delete (1) of [buffer* v]\n    if <<[nonsolid blocks v] contains (item ((selection index) + (1)) of [current level v])?> and <(item (selection index) of [fill buffer* v]) > [0]>> then\n        replace item ((selection index) + (1)) of [current level v] with (tile type)\n        replace item ((selection index) + (1)) of [fill buffer* v] with ((item (selection index) of [fill buffer* v]) - (1))\n        add ((selection index) + (1)) to [buffer* v]\n    end\n    if <<[nonsolid blocks v] contains (item ((selection index) + (-1)) of [current level v])?> and <(item (selection index) of [fill buffer* v]) > [0]>> then\n        replace item ((selection index) + (-1)) of [current level v] with (tile type)\n        replace item ((selection index) + (-1)) of [fill buffer* v] with ((item (selection index) of [fill buffer* v]) - (1))\n        add ((selection index) + (-1)) to [buffer* v]\n    end\n    if <<[nonsolid blocks v] contains (item ((selection index) + (24)) of [current level v])?> and <(item (selection index) of [fill buffer* v]) > [0]>> then\n        replace item ((selection index) + (24)) of [current level v] with (tile type)\n        replace item ((selection index) + (24)) of [fill buffer* v] with ((item (selection index) of [fill buffer* v]) - (1))\n        add ((selection index) + (24)) to [buffer* v]\n    end\n    if <<[nonsolid blocks v] contains (item ((selection index) + (-24)) of [current level v])?> and <(item (selection index) of [fill buffer* v]) > [0]>> then\n        replace item ((selection index) + (-24)) of [current level v] with (tile type)\n        replace item ((selection index) + (-24)) of [fill buffer* v] with ((item (selection index) of [fill buffer* v]) - (1))\n        add ((selection index) + (-24)) to [buffer* v]\n    end\nend\n\nwhen [1 v] key pressed\nset [selection index v] to ((round (((x position) + (240)) / (20))) + (((round (((180) - (y position)) / (20))) * (24)) - (24)))\nreplace item (selection index) of [current level v] with (tile type)\nbroadcast (refresh level v)\n\nwhen [4 v] key pressed\nset [selection index v] to ((round (((x position) + (240)) / (20))) + (((round (((180) - (y position)) / (20))) * (24)) - (24)))\nfill terrain with range [5]\nbroadcast (refresh level v)\n\n@level hitbox\n\ndefine create collisions\nshow\nset [ghost v] effect to (100)\ngo to x: (-230) y: (170)\nset size to (2000) %\nset [index v] to [1]\nset [clone count v] to [0]\nrepeat until <(item (index) of [current level v]) = []>\n    set [length v] to [0]\n    repeat until <not <[nonsolid blocks v] contains (item (index) of [current level v])?>>\n        change [index v] by (1)\n        change [length v] by (1)\n    end\n    repeat until <<[nonsolid blocks v] contains (item (index) of [current level v])?> or <(item (index) of [current level v]) = []>>\n        set [length v] to [1]\n        change [index v] by (1)\n        set x to ((((index) - (([floor v] of (((index) - (2)) / (24)) ) * (24))) * (20)) - (270))\n        repeat until <<[nonsolid blocks v] contains (item (index) of [current level v])?> or <<([floor v] of (((index) - (1)) / (24)) ) > ([floor v] of (((index) - (2)) / (24)) )> or <(item (index) of [current level v]) = []>>>\n            change [length v] by (1)\n            change [index v] by (1)\n        end\n        switch costume to (length)\n        set y to ((190) - (([ceiling v] of (((index) - (1)) / (24)) ) * (20)))\n        change [clone count v] by (1)\n        create clone of (_myself_ v)\n    end\nend\nhide\n\nwhen I receive [hitboxes v]\nrepeat (1)\n    delete this clone\nend\ncreate collisions\n\n@delete this!!!\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    play sound [Lifeformed - 9-Bit Expedition v] until done\nend\n\n
Welcome to the IntelliTiles engine, a highly modular, large-world, tile-based classic platformer system!\n\nPress M to edit the levels, press flag to exit.\nDetails and instructions inside the project :)\n\nNo clones, 'touching?' based platforming.