Page 2 of 2

Posted: Thu Jan 24, 2008 7:32 am
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...

Posted: Thu Jan 24, 2008 8:19 am
by pibeytor
i'm sorry i'm not perfect..


but i really appreciate all your help.. thnx guys

Posted: Thu Jan 24, 2008 11:02 am
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.

Posted: Thu Jan 24, 2008 3:56 pm
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?

Posted: Fri Jan 25, 2008 11:04 pm
by pibeytor
what are the basis of the growing.. adding parts or time..??

i mean, what's the function of Itimer in thes program?

Posted: Fri Jan 25, 2008 11:51 pm
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

Posted: Sun Jan 27, 2008 12:27 pm
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.

Posted: Mon Jan 28, 2008 9:00 pm
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!

I DID IT

Posted: Tue Jan 29, 2008 5:00 pm
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..

Posted: Tue Jan 29, 2008 6:14 pm
by Strong99
why make 100 predefined blocks? and not just with a list

and than still cpoy 2 to 1, 3 to 2 etc

Posted: Wed Jan 30, 2008 9:56 am
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..........