I don't really think that you're learning anything from this exercise...i'm dont really know how to feed it and make it grow..
Snake game with irrlicht
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
This is where you...pibeytor wrote:but i'm dont really know how to feed it and make it grow..
Greenya already explained it and then randomMesh pretty much coded it for you.pibeytor wrote:have to use lists or whatever they are called
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
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
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:
Further detail on "has to move left,right,up,down":
furhter detail on the detail
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
So:
specs:
Code: Select all
- has to move left,right,up,down
- has to eat
- get larger after eating
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
Compete or join in irrlichts monthly screenshot competition!
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
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.pibeytor wrote:what are the basis of the growing.. adding parts or time..??
i mean, what's the function of Itimer in thes program?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
I DID IT
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..
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..
why make 100 predefined blocks? and not just with a list
and than still cpoy 2 to 1, 3 to 2 etc
and than still cpoy 2 to 1, 3 to 2 etc
Compete or join in irrlichts monthly screenshot competition!
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
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..........
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..........