forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Shine's Lowser Snake Game

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Sat Jan 30, 2010 2:04 pm    Post subject: Shine's Lowser Snake Game Reply with quote

Hi Guys,
I'm trying to understand, and recode the way Shine's Snake game works.
I have a rough idea how to follow it, but have some questions.

How is it determined where the last segment of the snake is (the tail segment that is removed)?

Also, pretty much the same question, since the answer to any could probably answer both... how is the length of the snake kept track of?

Cheers, Art.
_________________
If not actually, then potentially.
Back to top
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Sat Jan 30, 2010 10:25 pm    Post subject: Reply with quote

I figure this:
Code:

   cell = cellTail
   while cell ~= cellHead do
      if cell.x == lastX and cell.y == lastY then
         gameOver = true
         break
      end
      cell = cell.next
   end

code checking for an end game condition is like a next...for loop.
So the game must be keeping an array of coordinates of old snake heads.
_________________
If not actually, then potentially.
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Sun Jan 31, 2010 1:56 am    Post subject: Reply with quote

Looks like a linked list of cells (note the cell = cell.next)
Back to top
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Sun Jan 31, 2010 8:37 am    Post subject: Reply with quote

I'm looking to code it for a microcontroller, so I don't get to use linked lists.
I guess this means I use an array of x,y coords for segment positions.
_________________
If not actually, then potentially.
Back to top
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Sun Jan 31, 2010 6:57 pm    Post subject: Reply with quote

Got it:

http://www.youtube.com/watch?v=k_83AWJxwrs

:)
_________________
If not actually, then potentially.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group