Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add = func(a, b) {
- return a + b
- }
- entity = class {
- _init_ = func {
- }
- }
- player = class : entity {
- _init_ = func {
- }
- }
- vec3 = class {
- _init_ = func (a, b, c) {
- declare(x=a, y=b, z=c)
- declare(r=a, g=b, b=b)
- }
- _toArgs_ = func {
- return x, y, z
- }
- _add_ = func(o) {
- return vec3(x + o.x, y + o.y, z + o.z)
- }
- }
- setWin(640, 480, black)
- _drawFunc_ = func {
- drawRect(0, 0, 10, 10, rgb(0, 255, 255))
- drawCube(vec3(0, 0, 0), 10, 10, 10, 255, 0, 255)
- }
- _pixel_ = shader(coord, res) {
- return rgb(coord/res)
- }
- //----------------------------------------------------------------
- //game of life, without the Ceullar Automata lib
- setWin(1000, 1000, black)
- import shapes
- import arrays
- import colors
- pixels = [100][100]
- for(pix:pixels[](x, y)) {
- pix = randBool()
- }
- _update_ = func {
- pixels0 = [[]]
- for(pix:pixels[](x, y)) {
- count = arrProc(pixels, vec2(x, y)).countNear(square(1, 1), func (i) {return i == true})
- if(count == 3 && pix == false)
- pixels0[x][y] = true
- else if(inRange(count, 2, 3) && pix == true)
- pixels0[x][y] = true
- }
- pixels = pixels0
- }
- _draw_ = func {
- for(pix:pixels[](x, y)) {
- drawSquare(x, y, 10, 10, white)
- }
- }
- //wireworld with the cellular automata lib
- import calib
- initCA(100, 100)
- _castates_ = castates {
- HEAD
- TAIL
- EMPTY
- WIRE
- }
- _carules_ = carules {
- HEAD -> TAIL
- TAIL -> WIRE
- WIRE -> HEAD if HEAD in range(1, 2)
- }
- //simple voxel game using the voxel engine
- import voxels
- setVoxelResPow(6)
- setRenderer(VCT)
- setVoxels(COLOR, EMPTY)
- _genVoxWorld_ = voxgen {
- pass0:
- !vox.color = genNoiseHeight()
- pass1:
- vox.color = isSurface()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement