Snake game with irrlicht

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

i'm dont really know how to feed it and make it grow..
I don't really think that you're learning anything from this exercise...
pibeytor
Posts: 17
Joined: Thu Nov 01, 2007 2:13 pm

Post by pibeytor »

i'm sorry i'm not perfect..


but i really appreciate all your help.. thnx guys
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

awwww, don't feel bad.

it's ok to be overwhelmed.

at least you have an idea how big the work is going to be.

keep on going and take the next step.
Image
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

pibeytor wrote:but i'm dont really know how to feed it and make it grow..
This is where you...
pibeytor wrote:have to use lists or whatever they are called
Greenya already explained it and then randomMesh pretty much coded it for you.

They've suggested/shown use of an array, rather than a list. Those are both examples of collections. This is the part where you learn about them. Do you have any specific questions about why an array has been suggested rather than a list, or why you should count backwards through it rather than forwards?
Last edited by rogerborg on Sun Jan 27, 2008 12:24 pm, edited 1 time in total.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
pibeytor
Posts: 17
Joined: Thu Nov 01, 2007 2:13 pm

Post by pibeytor »

what are the basis of the growing.. adding parts or time..??

i mean, what's the function of Itimer in thes program?
Strong99
Admin
Posts: 687
Joined: Fri Mar 31, 2006 7:06 pm
Location: Netherlands
Contact:

Post by Strong99 »

A better tip, make a specification document, add what it has to do, break those parts in more parts. Make psuedo code to get a sample what function has to what and than starting to code. instead working on something you don't know what it is or have to do.

So:

specs:

Code: Select all

- has to move left,right,up,down
- has to eat
- get larger after eating
Further detail on "has to move left,right,up,down":

Code: Select all

- Check if key is W move up
      move on point up
- Check if key is A move left
      move on point up
- Check if key is S move down
      move on point up
- Check if key is D move right
      move on point up

furhter detail on the detail

Code: Select all

- Check if key is W move up
      get Size of snake
      for count is not last snake part do
                set position of part to position of next snake part
            
until you got your whole program in normale language! Pseudeo code ;) and this will work very fast when you start the actual coding. Because you know wich direction you have to work to instead of just picking code samples out of the air/sky
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

pibeytor wrote:what are the basis of the growing.. adding parts or time..??

i mean, what's the function of Itimer in thes program?
It's not used for anything - yet. The code as written uses the space bar to demonstrate adding a new part. How and when you actually add one is up to you. The code isn't going to magically appear.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
pibeytor
Posts: 17
Joined: Thu Nov 01, 2007 2:13 pm

Post by pibeytor »

tnx guys yo did help me very much.

appreciate ur code randomMesh it was very useful
and thankyou for explainig greenya.

to everyone else, cheers!

see ya!
kiranmaya
Posts: 31
Joined: Tue Jan 30, 2007 9:10 am

I DID IT

Post by kiranmaya »

i devloped a snake game with irrlicht
http://www.megaupload.com/?d=E9VZI4LU

the logic is creating 100 cubes with id 1 to 100 ..and make it as invisible....and make it visible when ever the main cube position is hiting the apple mesh....copying the posi of 1 to 2..and 2 to 3..and 3 to 4..
Strong99
Admin
Posts: 687
Joined: Fri Mar 31, 2006 7:06 pm
Location: Netherlands
Contact:

Post by Strong99 »

why make 100 predefined blocks? and not just with a list

and than still cpoy 2 to 1, 3 to 2 etc
kiranmaya
Posts: 31
Joined: Tue Jan 30, 2007 9:10 am

Post by kiranmaya »

copying the position and applying the next cube is loop about 3 or four lines of code.........and im not applying the copied position to all the 100 nodes ..just length of the snake..........

and ...i think that instead of creating a new sceneNode .....it is better
to use existing sceneNode to turn into visible........ and calling the sceneNode by Id and an int value increment is very easy..........
Post Reply