Skip to content

Instantly share code, notes, and snippets.

<html>
<head>
</head>
<body onload="Start()">
<!--
<input type="button" onclick="AddBox()" value="Spawn crate"><input type="button" onmousedown="mouseD=true" onmouseup="mouseD=false" value="Spawn crates continuously"><br>
-->
<div id="screenArea" style="position: relative; background-image: url(loading.gif); width: 640px; height: 480px;"></div>
<br>
<pre>
# test of cc65's rand.s LCG
import math
import random
seed = 1
def srand(x):
global seed
seed = x & 0xFFFF
nicks=[];
for(var inv=0; inv<2; inv++){
for(var dir=0; dir<2; dir++){
for(var rots=0; rots<6; rots++){
var a="drnick".split("");
if(inv)a.reverse();
for(var r=0; r<rots; r++){
dir?a.unshift(a.pop()):a.push(a.shift());
}
if(a.join("")!="drnick"&&nicks.indexOf(a.join(""))<0)nicks.push(a.join(""));
//MIT License
//
//Copyright (c) [2016] kdrnic ( website: kdrnic.xyz )
//
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
@kdrnic
kdrnic / 3D.js
Created September 11, 2016 23:11
var _map = new Array();
_map[0] = new Array(2, 1, 2, 4, 4, 4, 4, 4, 4, 4, 4, 1);
_map[1] = new Array(2, 0, 2, 0, 0, 6, 0, 0, 0, 0, 4, 1);
_map[2] = new Array(2, 0, 2, 0, 0, 6, 0, 8, 8, 0, 4, 1);
_map[3] = new Array(2, 0, 0, 0, 0, 6, 0, 8, 8, 0, 4, 1);
_map[4] = new Array(2, 2, 2, 0, 0, 6, 0, 0, 0, 0, 4, 1);
_map[5] = new Array(4, 0, 0, 0, 0, 6, 0, 0, 8, 8, 4, 1);
_map[6] = new Array(4, 0, 7, 7, 0, 6, 0, 0, 8, 8, 4, 1);
_map[7] = new Array(4, 0, 7, 0, 0, 0, 0, 0, 0, 0, 4, 1);
float RadToDegree(float rad)
{
return (360.0 * rad) / (2.0 * M_PI);
}
float DegreeToRad(float degree)
{
return (degree * 2.0 * M_PI) / 360.0;
}
@kdrnic
kdrnic / stuff.txt
Created June 13, 2017 22:47
Game items, excluding characters/enemies and purely environmental objects
Chest
Bombs (dynamite, classic cartoon bomb, grenade)
Keys
Keycards
Potions
Heart (life heart, realistic organ)
Cash (paper, coins, ...)
Treasures (diamond, golden bars, bag with dollar sign, ...)
Gems
Egg
rem MIT License
rem
rem Copyright (c) 2014 kdrnic ( website: kdrnic.xyz )
rem
rem Permission is hereby granted, free of charge, to any person obtaining a copy
rem of this software and associated documentation files (the "Software"), to deal
rem in the Software without restriction, including without limitation the rights
rem to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
rem copies of the Software, and to permit persons to whom the Software is
rem furnished to do so, subject to the following conditions:
@kdrnic
kdrnic / megaman.cpp
Created June 22, 2017 00:29
Megaman in the blue mountains
// MIT License
//
// Copyright (c) 2012 kdrnic ( website: kdrnic.xyz )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
#define JS_FUNC(name) static duk_ret_t js_ ## name (duk_context *ctx)
JS_FUNC(Key)
{
int sc = duk_to_int(ctx, 0);
duk_push_number(ctx, key[sc]);
return 1;
}
JS_FUNC(Joystick)