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 - Chockosta

Pages: 1 ... 17 18 [19] 20 21 ... 31
271
TI-Nspire / Re: [Lua] CubeField
« on: October 23, 2011, 07:55:02 am »
Thanks :)

(And I'm very curious!)

EDIT : Oh, and by the way, the latest release is available here

272
TI-Nspire / Re: [Lua] CubeField
« on: October 23, 2011, 07:40:46 am »
Thanks a lot !
And yes, I entirely did that on-calc. (Just love on-calc programming)

What can you do for me ? :)

273
TI-Nspire / Re: [Lua] CubeField
« on: October 23, 2011, 07:31:18 am »
Update !

-Now when you turn, the cubes become diagonal.
-The bug which caused some blocks that are farther to appear on top of the closer ones is fixed.
-Before the speed increases, a "Speed Up!" sign appears.
-Between 2 "levels", there is a corridor made of cubes.

Should I keep my little square for the player or should I create a sprite ?

As usual, I've attached a TNS file which contains the code. Could someone please extract the code ?
Thanks !

274
TI-Nspire / Re: [Lua] CubeField
« on: October 19, 2011, 05:18:10 pm »
DJ_O :
The function gc:fillPolygon() could be used, it would be quite easy.
Thanks for the avi btw !

Jonius7 :
The corridor would be harder... Well, I would have to create levels instead of random cubes. But I could do this.
And your latest screenie is great ! Thanks ! :)

275
Other Calc-Related Projects and Ideas / Re: BBify your Z80, Axe, and Lua
« on: October 19, 2011, 02:16:37 pm »
Just amazing !
I love Lua support !
* Chockosta gives respect to DT

276
TI-Nspire / Re: [Lua] CubeField
« on: October 19, 2011, 11:17:26 am »
Thank you for the code !
And yeah, I need to fix 2 or 3 things.

DJ_O :
I really don't understand that bug...
NVM, fixed
And I'll try to make cubes more diagonal when you turn. It shouldn't be hard, but It will decrease the framerate a bit.

Jonius7 :
Thanks for the screenshot !
But it looks kinda weird... The framerate is really low and the grey squares don't show up...

Anyway, I'm going to add the TNS document and Jonius7's screenshot to the first post.
Could someone tell me if the document works for OS>=3.0.2 ?

277
TI-Nspire / Re: [Lua] CubeField
« on: October 18, 2011, 12:41:32 pm »
Yes...
There is Levak's script, but I'm too lazy :P

(Moreover, I don't have time, I really sould do my homework :( )

278
TI-Nspire / [Lua] CubeField
« on: October 18, 2011, 12:22:19 pm »
Hello !

I hate school, I don't have enough free time to work on my games. (Yeah, I have a lot of simultaneous game projects)
But I managed to get a playable CubeField clone...

So basically you just have to avoid cubes :P
When you reach 1000, 2000, 3000... points, the speed increases and the colors change.
The 3D projection is not really realistic, I'll have to work on it.
And I also have to add a nice sprite for the player's ship.

But you still can have fun with this... (My highscore is 5600 points ! Can you beat it ?)



DOWNLOAD FINAL VERSION (modified 11/1/2011) (re-modified 11/27/2011)


_________________
EDIT : 10/19/2011


Animated screenshot (thanks to Jonius7)
Spoiler For Spoiler:

_________________
EDIT : 23/10/2011

-Now when you turn, the cubes become diagonal.
-The bug which caused some blocks that are farther to appear on top of the closer ones is fixed.
-Before the speed increases, a "Speed Up!" sign appears.
-Between 2 "levels", there is a corridor made of cubes.

_________________
EDIT : 23/10/2011

FINAL VERSION !

-There is a nice sprite for the player
-The corridor is more regular

Screenshots :
Spoiler For Spoiler:

_________________
EDIT : 10/19/2011

New final version :P
The 3D projection is now more realistic.
A little bugfix

Screenie :


_________________
EDIT : 10/19/2011

Yet another final version

Now the speed of the cubes automatically adapts to the framerate.
So the speed is the same on CX, clickpad, or computer software.

Color screenie :


Code :
Spoiler For Spoiler:
Code: [Select]
playerImg=image.new("\020\000\000\000\020\000\000\000\000\000\000\000(\000\000\000\016\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\128\000\128\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128")

cubesX={1,5,7,6,4,6,4,1,3,2,3,7,8,9,1,2,3,4,2,6,7,1,9,1,2,3,4}
cubesY={1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8,9,9,9}
lastCube=1
player=0
speed=0.08
moving=false
dir=1
moveStart=0
menu=true
score=0
level=1
color={225,170,0}
rotation=0
lastTick=0
delay=0

function render(gc)
 drawHorizon(gc)
 local size,x,y,i,polygon
 for j=1,27 do
  i=(j+lastCube-2)%27+1
  size=100/(10-cubesY[i])
  x=(cubesX[i]-7-player)/(10-cubesY[i])*150-size/2
  y=5/(10-cubesY[i])*50-180
  polygon=rotate({x,y,x+size,y,x+size,y+size,x,y+size,x,y})
  if cubesY[i]>1 then
   gc:setColorRGB(color[1],color[2],color[3])
   gc:fillPolygon(polygon)
   gc:setColorRGB(0,0,0)
   gc:drawPolyLine(polygon)
  end
  if y+size>3 and y<17 then
   if x<6 and x+size>-6 then
    menu=true
    score=math.floor(score)
   end
  end
 end
end

function rotate(p)
 local s,c=math.sin(rotation),math.cos(rotation)
 return {p[1]*c-p[2]*s+159,p[1]*s+p[2]*c+202,p[3]*c-p[4]*s+159,p[3]*s+p[4]*c+202,p[5]*c-p[6]*s+159,p[5]*s+p[6]*c+202,p[7]*c-p[8]*s+159,p[7]*s+p[8]*c+202,p[9]*c-p[10]*s+159,p[9]*s+p[10]*c+202}
end

function updateCubes()
 local step=menu and 0.06 or speed
 for i=1,27 do
  cubesY[i]=cubesY[i]+step*delay/30
  if cubesY[i]>10 then
   if score%1000<800 then
    cubesX[i]=math.random(0,140)/10+player
   else
    cubesX[i]=math.random(0,140)/200+player+(i-1)%2*5+4.1
   end
   cubesY[i]=cubesY[i]-9
   lastCube=lastCube==1 and 27 or lastCube-1
  end
 end
end

function updateMove()
 if moving then
  player=player+0.07*dir*delay/30
  if math.abs(rotation)<0.15 or dir==rotation/math.abs(rotation) then
   rotation=rotation-0.005*dir*delay/30
  end
  if timer.getMilliSecCounter()-moveStart>=150 then
   moving=false
  end
 else
  if math.abs(rotation)>0.005 then
   rotation=rotation-0.005*rotation/math.abs(rotation)*delay/30
  end
 end
end

function drawPlayer(gc)
 if not menu then
  gc:drawImage(playerImg,149,192)
 end
end

function drawHorizon(gc)
 local s,c=math.sin(rotation),math.cos(rotation)
 gc:setColorRGB(0,0,0)
 gc:drawLine(s*142-c*200+159,202-c*142-s*200,c*200+s*142+159,s*200-c*142+202)
end

function drawMenu(gc)
 if menu then
  gc:setColorRGB(0,0,0)
  gc:setFont("sansserif","r",30)
  gc:drawString("CubeField",80,10,"top")
  gc:setFont("sansserif","b",12)
  gc:drawString("Press Enter",115,150,"top")
  local highscore=var.recall("highscore")
  if not highscore then
   var.store("highscore",0)
   highscore=0
  end
  if score>highscore then
   var.store("highscore",score)
   document.markChanged()
  end
  local str="Score : "..tostring(score).."              Highscore : "..tostring(highscore)
  gc:drawString(str,159-gc:getStringWidth(str)/2,100,"top")
 end
end

function drawScore(gc)
 if not menu then
  gc:setColorRGB(0,0,0)
  gc:setFont("sansserif","r",12)
  gc:drawString(tostring(math.floor(score)),2,0,"top")
  if score%1000>950 then
   gc:setFont("sansserif","r",30)
   gc:drawString("Speed Up !",80,10,"top")
  end
 end
end

function levelUp()
 speed=speed+0.02
 level=level+1
 if (level-1)%5==0 then
  color={225,170,0}
 elseif (level-1)%5==1 then
  color={0,0,255}
 elseif (level-1)%5==2 then
  color={100,100,100}
 elseif (level-1)%5==3 then
  color={90,255,0}
 elseif (level-1)%5==4 then
  color={255,255,255}
 end
end

function on.paint(gc)
 render(gc)
 drawPlayer(gc)
 drawMenu(gc)
 drawScore(gc)
 gc:setColorRGB(0,0,0)
 gc:setFont("sansserif","r",8)
 gc:drawString("Lua CubeField - Par Loic Pujet",10,200,"top")
 updateFPS()
 timer.start(0.01)
end

function on.timer()
 timer.stop()
 updateCubes()
 updateMove()
 if not menu then
  score=score+delay/30
  if score>level*1000 then
   levelUp()
  end
 end
 platform.window:invalidate()
end

function on.enterKey()
 if menu then
  menu=false
  speed=0.08
  moving=false
  score=0
  level=1
  color={225,170,0}
  for i=1,27 do
   cubesY[i]=cubesY[i]-5
  end
 end
end

function on.arrowLeft()
 if not menu then
  dir=-1
  moving=true
  moveStart=timer.getMilliSecCounter()
 end
end

function on.arrowRight()
 if not menu then
  dir=1
  moving=true
  moveStart=timer.getMilliSecCounter()
 end
end

function on.charIn(ch)
 if ch=="6" then
  on.arrowRight()
 elseif ch=="4" then
  on.arrowLeft()
 end
end

function updateFPS()
 delay=timer.getMilliSecCounter()-lastTick
 delay=delay<300 and delay or 0
 lastTick=timer.getMilliSecCounter()
end

279
Other Calc-Related Projects and Ideas / Re: The Necrotorium
« on: October 15, 2011, 08:24:17 am »
Really nice!
I like the syntax.

It would be really great if you managed to create a procedural language. Maybe that it's  possible with a correct speed...

280
Lua / Re: Oh Nspire-Lua, you so crazy!
« on: October 12, 2011, 08:27:01 am »
This happened to me really often, when I was playing with a little text editor that I made.
I even stored chinese characters in an external string :)

281
Other Calc-Related Projects and Ideas / Re: The Necrotorium
« on: October 12, 2011, 08:15:31 am »
Nice projects !

nGfx will certainly be really useful !
But I think that Lua IDE won't be a revolution. OCLua is great... Maybe that keywords highlighting would be useful.
And there are already several bitmap->ti.image converters. An on-calc one would not be useful... (And I even don't think that it is possible, because where would you store bitmaps ?)

Anyway, I'll check this topic quite often.

282
Graviter / Re: Graviter
« on: October 12, 2011, 08:04:39 am »
Just awesome.
Do you have a planned date for a playable release ?

283
News / Re: Members organizes ritual for DJ_O's postcount of 30000
« on: October 12, 2011, 08:00:38 am »
Congrats !

284
TI Z80 / Re: Firefall (Beta)
« on: October 09, 2011, 08:24:20 am »
I love this game ! Congrats, BuilderBoy...
BTW, how can you do more than 100 000 ? For me, it was really hard to get 10 000...

285
TI Z80 / Re: My first Axe game
« on: October 07, 2011, 01:11:29 pm »
Awesome !
This is exactly the kind of games which gets me to play for hours...

Pages: 1 ... 17 18 [19] 20 21 ... 31