Log In  

BBS > Community Superblog
All | Following | GIFs | Off-site

can someone tell me why this throws the error "attempt to call global vec a table value"?
vec clearly has its metatable set with a call metaevent

vec=
{	
	x=0,
	y=0,
	mag=function(o) return sqrt (o.x^2+o.y^2) end,
 ang=function(o) return atan2(o.x,  o.y  ) end,
 nrm=function(o) return vec(o:ang()/360) end,  
}
vecmeta=
{
	 __call=function(o,x,y)
	  o  =o or {} 
			o.x=y and x or cos((x+90)/360)
			o.y=y and y or-sin((x+90)/360)	
			return setmetatable(o,vec)
		end,
		__eq=function(a,b)
			a=type(a) == "number" and vec(a,a) or a
			b=type(b) == "number" and vec(b,b) or b
			return (a.x==b.x and a.y==b.y)
		end,
		__add=function(a,b)
			a=type(a) == "number" and vec(a,a) or a
			b=type(b) == "number" and vec(b,b) or b
			return vec(a.x+b.x,a.y+b.y)
		end,
		__sub=function(a,b)
			a=type(a) == "number" and vec(a,a) or a
			b=type(b) == "number" and vec(b,b) or b
			return vec(a.x-b.x,a.y-b.y)
		end,
		__mul=function(a,b)
			a=type(a) == "number" and vec(a,a) or a
			b=type(b) == "number" and vec(b,b) or b
			return vec(a.x*b.x,a.y*b.y)
		end,
		__div=function(a,b)
  	a=type(a) == "number" and vec(a,a) or a
			b=type(b) == "number" and vec(b,b) or b
			return vec(a.x/b.x,a.y/b.y)
		end,
}
setmetatable(vec, vecmeta)

local test =
{
	pos=vec(0,0),
	vel=vec(0,0),
}
0 comments




This is a project I made for a class at college. It follows the trajectory of Victor Frankenstein through scenes from the novel "Frankenstein," analyzing how his 'family triangle' of relationships (that is, father, mother, and son, or the lack of these) changes over time. Each scene compares the location in the present day to their depiction in the novel (denoted as "1818").

Cart #frankenstein-1 | 2019-07-15 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

The code is rushed, highly redundant, and resembles delicious spaghetti; please don't look at it.

1
1 comment


Cart #fireflier-2 | 2019-08-12 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Fire Flier

Make your way past the nasty June bugs to get to the end of the map. Touching the top of the map or a June bug will end the game. Tap UP button to fly

0 comments


FIRE FLYER

Demo for the first Pico-8 game I am trying to create. Final product will be named "FireFlyer" by Jake Fischer

1 comment


Cart #mcleopold_memory-0 | 2019-07-15 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

Memory Card Game

Flip over two card to see if the pictures match. 1 point for each match is awarded.

For 1 to 4 players. Use a controller for each player.

  • Start: use the menu to:

    • select player count (and reshuffle deck)
    • toggle music on/off
  • Up/Down/Left/Right: select card to flip over

  • Z: flip card over
1
0 comments


Cart #breakoutfishy-0 | 2019-07-15 | Code ▽ | Embed ▽ | No License

Press 'x' to start the game.

Normal game of breakout; left and right arrows. WIP.

0 comments


Cart #anotherbogbyaloser1730-0 | 2019-07-15 | Code ▽ | Embed ▽ | No License

Simply push Z to play. Some Computers use X, not sure why using a different computer makes the key change.By Molly Ince CIS 102 T302

0 comments


Cart #tmbstn1-0 | 2019-07-15 | Code ▽ | Embed ▽ | No License
1


Midterm project for CIS 102

1
0 comments


Cart #rakobikeha-0 | 2019-07-15 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

1 comment


Cart #picklerick1-0 | 2019-07-15 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Uploading cart for school. Sprites added and more sound!

Cart #picklebreakout1-0 | 2019-08-11 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA


Check back frequently for a Pickle Rick adventure, as you play a pickle rolling across water and dodging enemies! Put the Rick in rick roll!

0 comments


Cart #balls_h8_brix-0 | 2019-07-15 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

This is my first game made with PICO-8. I have dabbled quite a bit in Unity, but PICO-8 limited me enough to actually see a game through to "completion". That, and this was for a game programming class that I would like to pass!

1
0 comments


Cart #pfrowe-0 | 2019-07-14 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

0 comments


Cart #almost-1 | 2019-07-14 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA


Some simple features of brick breaker

0 comments


Hell Hole: Final Release

Cart #hellhole-10 | 2020-05-21 | Code ▽ | Embed ▽ | No License
23

Manual

Controls:

  • Movement: up,down,left,right
  • Attack: Hold X or Z

How To Play:

  • Move your avatar around the screen to avoid getting hit by demons and saw-blades.
  • Hold the attack buttons to shoot your soul out and control it to hit demons.
  • You can't move your body while using your soul. Your body is still vulnerable.
  • Let go of the attack button to return your soul to your body.
  • You can't damage saw-blades.
  • Survive 66 seconds...

Characters:

[ Continue Reading.. ]

23
5 comments




Cart #pojawomawa-2 | 2019-07-14 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

How to use

All value in the make_particle are from 0 to 1 and use either
axis([number], [velocity], [acceleration], [inertia]): progressing value
or
{y, length}: reads a set of values over time in sprite data
make_particle(X, Y, Color, Angle of rotation, lifetime)
you can also use it in conjunction with
make_emitter(function, time, [every x frames])

Thank you

Id really like to hear your feedback on it !

The code

-- Axis are from 0 to 1
-- Axis(x, y, c, r) - axis variable
-- {,} - axis texture [1]: texture y position [2]: texture length
function make_particle(_x, _y, _c, _r, _maxl)
 p = {
 x=_x,

[ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=65839#p)
4
0 comments


Cart #hidadejize-0 | 2019-07-14 | Code ▽ | Embed ▽ | No License


Post for my midterm project.
It is a two player pong.
Player one uses the arrow keys
Player two uses E and D

0 comments


Cart #fedomamune-0 | 2019-07-14 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

For Bellevue Class. I find this to be an extremely challenging class but it is a lot of fun trying to work my brain into how this program works.

0 comments


Cart #muyoderaja-0 | 2019-07-14 | Code ▽ | Embed ▽ | No License

0 comments




Top    Load More Posts ->