Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - cypressx1

Pages: 1 [2] 3 4
16
it's a nice game.can we share your codes?

17
Other Calculators / Re: Lua Alien Invaders
« on: July 26, 2011, 08:23:52 am »
do you forgot to use the var.monitor() ?

18
Lua / Re: How can l make it ?
« on: July 26, 2011, 08:08:52 am »
ok,thanks! by the way, l have another question, can we use two different timer.start() at one time? for example,  l start the  timer with timer.start(XX)  "XX will change", and l also want the clock function which l programmed work well ?

19
News / Re: Prizm Video Player and Nspire OS 3.1
« on: July 26, 2011, 07:51:55 am »
maybe.

20
Lua / Re: How can l make it ?
« on: July 23, 2011, 08:37:19 am »
No one ?

21
Other Calculators / Re: Make PTT not Delete Groups
« on: July 23, 2011, 08:35:41 am »
That's cool !

22
Pokémon Purple / Re: [PP] Progress '11
« on: July 23, 2011, 08:32:48 am »
it looks cute

23
News / Re: Prizm Video Player and Nspire OS 3.1
« on: July 23, 2011, 08:26:13 am »
really? like what ?

24
News / Re: Prizm Video Player and Nspire OS 3.1
« on: July 23, 2011, 07:19:59 am »
will OS3.1 improve the lua programming?

25
Lua / How can l make it ?
« on: July 22, 2011, 07:11:59 am »
Code:(lua)
Code: [Select]
----------block1-------------
block1=class()
bw,bh=80,70
cc=20 ff=25     t1="start" t2="stop"
tp=0.02
st=1
n=1/2.5

-----st must =ff or ff≥st+1------
function block1:init()
end
function block1:set()
wbx,wby=platform.window:width(),platform.window:height()
bx=wbx/2-bw/2
by=wby/2-bh/2
end

function block1:setc1()
block1:set()
c1x,c1y,c1w,c1h=bx,by+bh/2-cc/2,bw,cc
end
function block1:setc2()
block1:set()
c2x,c2y,c2w,c2h=bx+bw/2-cc/2,by,cc,bh
end

function block1:paint(gc)
gc:setColorRGB(150,200,100)
block1:set()
gc:fillRect(bx,by,bw,bh)
-------c1------
gc:setColorRGB(0,0,0)
block1:setc1()
gc:fillRect(c1x,c1y,c1w,c1h)
-----c2-------
gc:setColorRGB(0,0,0)
block1:setc2()
gc:fillRect(c2x,c2y,c2w,c2h)
end
function block1:timer()
platform.window:invalidate()
end
--------mouse------
Mouse=class()
mx=0
my=0
function Mouse:init()
end
function Mouse:paint(gc)
gc:setFont("sansserif","i",10)
gc:drawString("MouseLocation : ( "..mx.." , "..my.." )",60,0,"top")
end
function on.mouseMove(x,y)
mx=x
my=y
end
function Mouse:send()
--Ox=mx
end
function Mouse:timer()
platform.window:invalidate()
end
--------------------------
--[[
function ST()
if B1x<140 or B1x>171
then st=1
elseif B1x>140 and B1x<171
then st=1
end end
--]]
-----------Steps----------
function step1()
  if B1x==c2x-ff  --and B2y==c1y
   then t1="start"
end
if B1x==c2x+ff
   then t1="stop"
return step2()
   end
--ST()
B1x=B1x+st
 B2y=B1y-(ff^2-(B1x-B2x)^2)^0.5
 --B2y=math.eval("round("..B2y..",0)")
end
 
function step2()
  if B1x==c2x+ff --and B2y==c1y
   then t2="start"
end
if B1x==c2x-ff
   then t2="stop" B1x=c2x-ff
--timer.stop()
return step1() 
 end
--ST()
B1x=B1x-st
 B2y=B1y+(ff^2-(B1x-B2x)^2)^0.5
--B2y=math.eval("round("..B2y..",0)")
end






B1=class()
block1:setc1()
 block1:setc2()
B1x,B1y,B2x,B2y=c2x-ff,c1y,c2x,c1y
function B1:paint(gc)
step1()
gc:fillArc(B1x,B1y,cc,cc,0,360)
gc:fillArc(B2x,B2y,cc,cc,0,360)
end
B2=class()
block1:setc1()
 block1:setc2()
function B2:paint(gc)
step2()
gc:fillArc(B1x,B1y,cc,cc,0,360)
gc:fillArc(B2x,B2y,cc,cc,0,360)
end



-----------------------
function on.paint(gc)
block1():paint(gc)
Mouse():paint(gc)
gc:setColorRGB(255,255,255)
if t1=="start" then
B1():paint(gc)
end
if t2=="start" then
B2():paint(gc)
end
gc:setColorRGB(0,0,0)
gc:setFont("sansserif","i",10)
gc:drawString(t1.." "..t2,0,0,"top")
gc:drawString("( "..B1x.." , "..B1y.." )",100,199)
gc:drawString(" ( "..B2x.." , "..B2y.." )",100,212)
d=((B1x-B2x)^2+(B1y-B2y)^2)^0.5
d=math.eval("iPart("..d..")")
gc:drawString(d..st,100,180)
-------o-------
--Mouse:send()
--l=math.eval("linsolve("..B1y.."=k*"..B1x.."+b and "..B2y.." =k*"..B2x.."+b,{k,b})")
Ox=(B2x*(1+n)-B1x)/n
Oy=(B2y*(1+n)-B1y)/n
gc:fillArc(Ox,Oy,cc,cc,0,360)
end


function on.timer()
timer.start(tp)
block1():timer()
Mouse():timer()
platform.window:invalidate()
end
on.timer()

l'm leaning the lua. l want to make a prgm to draw the oval. But l don't know how to draw the ball's locus on the screen.in addition, l also want to make the vertical ball move more smoothly? Please give me some ideas :)

26
Lua / Re: Lua Q&A
« on: July 18, 2011, 08:22:08 am »
Thanks!

27
News / Re: TI-Nspire CX officially released at $159.99
« on: July 15, 2011, 09:23:19 am »
however,l have had a Tp

28
Lua / Re: Lua Q&A
« on: July 15, 2011, 09:16:46 am »
........... function on.paint(gc) .......Text=editor:getText()  gc:drawString(Text,0,0) end   May this work

29
Lua / Re: Controlling external hardware through Lua
« on: July 15, 2011, 09:09:22 am »
Really good job.

30
Lua / Re: what should l do if l want two speed? it doesn't work
« on: July 10, 2011, 07:02:56 am »
 :love: do you have an E-mail address ?

Pages: 1 [2] 3 4