[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
coding
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 10
Thread images: 1
File: htrfctyhrc ytrc5y.jpg (6 KB, 300x168) Image search: [Google]
htrfctyhrc ytrc5y.jpg
6 KB, 300x168
I need to re-code a snake game for class, so any advice on it... I know it is not that hard but I just started coding and I am going to do it in javascript so any help?
>>
This has been done dozens of time before. Learn to use a search engine.
>>
It has to be original
>>
>>54714672
Just write it. You'll learn more from fucking it up than you will from being told how to do it.
>>
it is due friday... but ig i can go full retard staying up all night and doing it at school during lunch and the class i have it fore
>>
Just steal someone's code and change all the variable/method names like the rest of your class is doing :^)
>>
>>54714888
In 3 days? That's too much time.
>>
>>54714672
You can do this >>54714961 if you don't want to learn.

Also if you have a certain coding/naming style, make sure you adhere to it so you don't give it away.
>>
have an update method
Have a draw method
Think about your data structures for the snake, the food, and the "world" that the snake and food will be at

Your snake needs to move, so it would need a velocity

Then just have methods on what happens when you collide with the food and the snake body, on movement from input keys, etc
>>
>>54715116
AABB collision detection, google that

Or make it grid based, then you will know what position the food is with your snake head
Thread replies: 10
Thread images: 1

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.