Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Work in Progress / Blast Snake

Author
Message
Blastwave man
18
Years of Service
User Offline
Joined: 12th Sep 2006
Location: ...don\'t look behind you.
Posted: 21st Jun 2007 06:31 Edited at: 21st Jun 2007 06:34
Well, started on my new project, just an hour ago really,

Just a simple snake game, almost done actually. Only thing left to do is setup collision for the snake, and fix the fruit so it doesn't spawn inside the snake

Screen Shot:


Source Code(So far, comments welcome on improving my coding skills):


Question:
Is there a better way to make a "for z=1to10" loop go backwards?
right now I'm using negative numbers, and just using absolute value, though if my object add number is the same as the negative, it gives me a nice error, cause there is no object zero, lol.

Blastwave Man


"I wish I was a wizard, becuase then I could wave my wand and perfect code would just appear."
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 21st Jun 2007 06:37
Uhh...

For x=10 to 1 step-1
BLAH BLAH
Next x

That should work.



Looks nice.

Blastwave man
18
Years of Service
User Offline
Joined: 12th Sep 2006
Location: ...don\'t look behind you.
Posted: 21st Jun 2007 06:40 Edited at: 21st Jun 2007 06:41
actually that doesn't work, lol, first thing i tried. so I'm doing negatives instead. It works, and I'm not really worried about it for this snake clone, lol.

edit: didn't see the step-1...I've never seen that used in example codes, thanks for the info.

BWM


"I wish I was a wizard, becuase then I could wave my wand and perfect code would just appear."
Blastwave man
18
Years of Service
User Offline
Joined: 12th Sep 2006
Location: ...don\'t look behind you.
Posted: 21st Jun 2007 07:40
Done, lol. Now on to my next 'small' project. Seriously, setting the simplest goals, I think I might go far with this indie stuff, lol.



Source Code(Comments and suggestions wanted):


BWM


"I wish I was a wizard, becuase then I could wave my wand and perfect code would just appear."

Attachments

Login to view attachments
tiresius
21
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 21st Jun 2007 08:11
This game is a great small project. I applaud you for starting small and building on it!!

There is a lot you can do with this game, getting into some more advanced coding techniques if you want. I'm not talking about graphics or anything shnazzy, just good coding practices.

Just some suggestions:
- Use functions instead of a giant DO loop
- Do not use Goto, just use another DO loop with a different condition
- User defined types will keep your variables easy to track
- Instead of hard coding object numbers (or range of them), use an available object function
- Investigate the use of array lists/queues to add object numbers to your snake instead of a hard-coded range
- Use a real timer() instead of a variable counter for delays


That list is pretty vague, if you need any help with specifics let me know and I'll try to help. Just illuminating the possibilities and throwing them out there.

I'm not a real programmer but I play one with DBPro!
Blastwave man
18
Years of Service
User Offline
Joined: 12th Sep 2006
Location: ...don\'t look behind you.
Posted: 21st Jun 2007 19:44
Thanks for the input, I will be trying to apply those in my next project: Blast Invaders.

Wip coming soon, just finished the graphics and now coding the basic engine.

BWM


"I wish I was a wizard, becuase then I could wave my wand and perfect code would just appear."
Shadow heart
17
Years of Service
User Offline
Joined: 2nd Dec 2006
Location: US
Posted: 22nd Jun 2007 00:51 Edited at: 22nd Jun 2007 00:51
it was pretty fun, but the snake needs to be sped up alittle bit:

to the ones thats trapped inside of you, this is it!!
Blastwave man
18
Years of Service
User Offline
Joined: 12th Sep 2006
Location: ...don\'t look behind you.
Posted: 22nd Jun 2007 02:18
I'm done with the snake game, but your free to alter and repost the source if you want.

Many things can be added to these little remakes, but as of right now, I'm not worried about fine details, but principles and correct programing.

BWM


"I wish I was a wizard, becuase then I could wave my wand and perfect code would just appear."

Login to post a reply

Server time is: 2024-09-29 20:26:46
Your offset time is: 2024-09-29 20:26:46