PicoPicoGameEngine

Quick Links

Geometory Objects

pppoint

pppoint()

p = pppoint(x,y)
p = pppoint({x,y})
p = pppoint(pos)
x : number

y : number

pos : point object

p : point object

.x
.y

x_pos = p.x
y_pos = p.y
p.x = x_pos
p.y = y_pos
p : point object

x_pos : number

y_pos : number

:length()

len = p:length()
p : point object

len : number

:length()

len = p:length(x,y)
len = p:length({x,y})
len = p:length(pos)
p : point object

x : number

y : number

pos : point object

len : number

pprect

pprect()

r = pprect(x,y,width,height)
r = pprect({x,y,width,height})
r = pprect(rect)
r : pprect object

.x
.y

x_pos = r.x
y_pos = r.y
r.x = x_pos
r.y = y_pos
r : pprect object

x_pos : number

y_pos : number

.width
.height

width = r.width
height = r.height
r.width = width
r.height = height
r : pprect object

width : number

height : number

:min()

p = r:min()
r : pprect object

p : point object

:max()

p = r:max()
r : pprect object

p : point object

:center()

p = r:center()
r : pprect object

name : string
p : point object

:equalToSize()

result = r1:equalToSize(r2)
r1 : pprect object

r2 : pprect object

result : boolean

  • true
  • false

:equalToRect(})

result = r1:equalToRect(r2)
r1 : pprect object

r2 : pprect object

result : boolean

  • true
  • false

:isEmpty()

result = r:isEmpty()
r : pprect object

result : boolean

  • true
  • false

:move()

r:move(x,y)
r:move({x,y})
r:move(pos)
r : pprect object

x : number

y : number

pos : point object

:position()
:pos()

r:position(x,y)
r:pos(x,y)
r:position({x,y})
r:pos({x,y})
r:position(pos)
r:pos(pos)
p = r:position()
p = r:pos()
r : pprect object

x : number

y : number

pos : point object

p : ppoint object

:size()

r:size(width,height)
r:size({width,height})
r:size(size)
size = r:size()
r : pprect object

width : number

height : number

size : rectangle object

:scale()

r:scale(a)
r : pprect object

a : number

:inset()

r:inset(x,y)
r:inset({x,y})
r:inset(inset)
r : pprect object

x : number

y : number

inset : point object

:contain()

result = r:contain(x,y)
result = r:contain({x,y})
result = r:contain(pos)
r : pprect object

x : number

y : number

pos : point object

result : boolean

  • true
  • false

:intersect()

result = r1:intersect(r2)
r1 : pprect object

r2 : pprect object

result : boolean

  • true
  • false

:union()

rect = r1:union(r2)
r1 : pprect object

r2 : pprect object

rect : pprect object

:length()

len = r:length(x,y)
len = r:length({x,y})
len = r:length(pos)
r : pprect object

len : number

x : number

y : number

pos : point object

:hitCheck()

r:hitCheck(point_array,[hit_func])
r : pprect object

point_array : object

hit_func : function/optional

--default hit_func
function(self,point)
  return self:contain(point)
end
g=ppgraph
r=pprect(110,110,100,100)

function start()
  local hit=false
  local t=pptouch()
  if r:hitCheck(t) then
    g:fill(r,g.red)
  else
    g:box(r,g.white)
  end
end