Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Games Development Work
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jack.webb
Games Development Work
Commits
84a97dc2
Commit
84a97dc2
authored
Jan 04, 2019
by
jack.webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Snake
parent
ac354c5b
Pipeline
#581
failed with stages
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
Snake
Snake
+3
-0
No files found.
Snake
View file @
84a97dc2
...
@@ -52,6 +52,9 @@ void draw() {
...
@@ -52,6 +52,9 @@ void draw() {
//Boundries, so game ends if touch sides
//Boundries, so game ends if touch sides
if(x.get(0) < 0 || y.get(0) < 0 || x.get(0) >= w || y.get(0) >= h) gameover = true;
if(x.get(0) < 0 || y.get(0) < 0 || x.get(0) >= w || y.get(0) >= h) gameover = true;
//Prevents the snake moving over itself, and going backwords
for(int i=1;i<x.size();i++) if(x.get(0)==x.get(i)&&y.get(0)==y.get(i)) gameover=true;
//If snake eats apple, add length and randomise apple position
//If snake eats apple, add length and randomise apple position
if (x.get(0)==applex && y.get(0)==appley) {
if (x.get(0)==applex && y.get(0)==appley) {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment