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), } |
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").
The code is rushed, highly redundant, and resembles delicious spaghetti; please don't look at it.
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
Hell Hole: Final Release
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:
- Player:
[0x0]
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) |