Obligatory Matrix Simulator

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
Zenurb
Posts: 106
Joined: Fri Sep 30, 2005 8:33 am
Location: United Kingdom
Contact:

Obligatory Matrix Simulator

Post by Zenurb »

So I just started tinkering with Lua / LuaPlayer this evening, since I bought my USB-PSP cable a few days ago. Everyone and his dog has probably already done this but here's my attempt, first time with a new language and all, so be gentle! Comments / Feedback appricated, even flames ;)

Code: Select all

mtdark = Color.new(83, 186, 0)
mtlight = Color.new(191, 234, 0)

scrollcount = 5

mtrand = math.random(30, 40)

scrollx = {}
scrolly = {}
scrollorigy = {}
scrollspeed = {}

function setVars(i)
	scrollx[i] = math.random(0, 58)
	scrolly[i] = math.random(0, 26 / 2)
	scrollorigy[i] = scrolly[i]
      scrollspeed[i] = math.random(1, 2)
end

for i = 0, scrollcount do
	setVars(i)
end

while true do
	screen:clear()

	for i = 0, scrollcount do
		screen:print(6 + (8 * scrollx[i]), 2 + (10 * scrolly[i]), math.random(0, 9), mtlight)
		if scrolly[i] > scrollorigy[i] then
                  for j = 0, scrolly[i] - scrollorigy[i] do
				red = (j / (scrolly[i] - scrollorigy[i])) * 191
				green = (j / (scrolly[i] - scrollorigy[i])) * 234
				screen:print(6 + (8 * scrollx[i]), 2 + (10 * (scrolly[i]-j)), math.random(0, 9), Color.new(191 - red, 234 - green, 0))
			end
		end
            scrolly[i] = scrolly[i] + scrollspeed[i]
            if scrolly[i] > 30 then
			setVars(i)
			if scrollcount < 15 then 
				scrollcount = scrollcount + 1
				setVars&#40;scrollcount&#41;
			end
		end
	end
      screen&#58;fillRect&#40;200, 260, 280, 10, Color.new&#40;0, 0, 0&#41;&#41; 
	screen&#58;print&#40;207, 264, "Matrix Simulator for PSP by Zenurb", Color.new&#40;255, 255, 255&#41;&#41;
	screen.waitVblankStart&#40;&#41;
	screen.flip&#40;&#41;

	pad = Controls.read&#40;&#41;
	if pad&#58;start&#40;&#41; then
		break
	end
end
edit - Screenshot!
Image
Proud Dvorak User
US 1.5 PSP (Original)
flattspott
Posts: 22
Joined: Mon Aug 22, 2005 4:06 am

Post by flattspott »

Nooooo. I wanted to do that one to
booger
Posts: 16
Joined: Sun Jul 03, 2005 11:19 pm
Location: El Segundo CA
Contact:

Post by booger »

Heh. That's pretty good.
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

nice one!
colors (first one was white then followed by green if i am right)

greets
Lumo
PS: did you find a phonce yet? ;)
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Zenurb
Posts: 106
Joined: Fri Sep 30, 2005 8:33 am
Location: United Kingdom
Contact:

Post by Zenurb »

LuMo wrote:nice one!
colors (first one was white then followed by green if i am right)

greets
Lumo
PS: did you find a phonce yet? ;)


phonce?

What about the colors?

(In college right now, qwerty sucks.)
Proud Dvorak User
US 1.5 PSP (Original)
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

original matrix effect was white, followed by green, wich was getting lighter, thats what i meant

lumo
PS: they used phones to get out of the matrix ;)
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Zenurb
Posts: 106
Joined: Fri Sep 30, 2005 8:33 am
Location: United Kingdom
Contact:

Post by Zenurb »

LuMo wrote:original matrix effect was white, followed by green, wich was getting lighter, thats what i meant

lumo
PS: they used phones to get out of the matrix ;)

Ohhhhh hehe. :)
Proud Dvorak User
US 1.5 PSP (Original)
Zenurb
Posts: 106
Joined: Fri Sep 30, 2005 8:33 am
Location: United Kingdom
Contact:

Post by Zenurb »

Image

I was working off this image.

The colour on the photo is a bit off as I was taking the picture at four am =)
Proud Dvorak User
US 1.5 PSP (Original)
Post Reply