Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="800" height="800" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.</canvas>
<script>
//For Gist: https://gist.github.com/im4aLL/548c11c56dbc7267a2fe96bda6ed348b
preg_match('/Event::trigger\(((\'|\").*)(,|\',) \[(.*)]\)/', $line, $matches);
if(count($matches)>0) {
var_dump($matches);
/*array(5) {
[0]=>
string(40) "Event::trigger('get_cp_menu', [&$menus])"
[1]=>
string(13) "'get_cp_menu'"
[2]=>
ddaWalk(x, y, endX, endY) {
//DDA Algorithm https://lodev.org/cgtutor/raycasting.html
//https://www.youtube.com/watch?v=NbSee-XM7WA
//https://github.com/OneLoneCoder/olcPixelGameEngine
const Vector = Matter.Vector; //Replace with whatever Vector class you use
let mapSize = Vector.create(100, 100); //Grid size in cell size