Absolutely! We encourage you to create your own social media channels, such as YouTube, Twitch, or Instagram, to showcase the amazing games you've created on our platform. You can also share the latest news from our Discord server and playtest games created by other users.
Tag us or use our designated hashtags so we can discover and share your content with our wider audience.
#createwithstruckd #playonstruckd
Comments
7 comments
YK GAMING STUDIO
https://support.struckd.com/hc/en-gb/articles/12961617852818/comments/19123316895250
VERY GOOD
1413121110987431
var Snake = (function () {
2
3
4
const gameingworld= 5;
var fixedTail = true;
5
6
7
8
9
var intervalID;
var tileCount = 10;
var gridSize = 400/tileCount;
10
11
const INITIAL_PLAYER = { x: Math .floor(tileCount / 2), y: Math .floor(tileCount / 2) };
12
13
var velocity = { x:0, y:0 };
14
var player = { x: INITIAL_PLAYER.x, y: INITIAL_PLAYER.y };
var walls = false;
15
16
17
18
var fruit = { x:4, y:4};
19
var trail = [];
21
20
var tail INITIAL_TAIL;
22
var reward = 5;
23
24
var points = 0;
25
var pointsMax = 10000000000;
26
var ActionEnum = { 'none': 0, 'up': 1 'down': 2, 'left':3, 'right':4}
27
(2545552534951474845464344ctx.fillStyle42404138393637343533document.getElementById32313029Object.freeze528
; champ: 5
Object.freeze (ActionEnum);
29
var lastAction = ActionEnum.none;
30
31
function setup () {
32
canv = document.getElementById
('gc');
33
ctx = canv.getContext('2d');
34
game.reset();
35
36
}
37
38
var game = {
39
40
reset: function () {
41
ctx.fillStyle = 'grey';
42
ctx.fillRect(0, 0, canv.width, canv.height);
43
44
tail = INITIAL_TAIL;
45
points = 0;
46
velocity.x = 0;
47
velocity.y = 0;
48
49
player.x = INITIAL_PLAYER.x;
50
player.y = INITIAL_PLAYER.y;
51
// this. RandomFruit();
52
53
reward=-1;
54
lastAction = ActionEnum.none;
55
trail = [];28798077787576737471726970676865666416263616058595705656
50
trail.push({x: player.x, y:
57
player.y });
// for(var j = 0 ; i<tail; i++)
trail.push({x: player.x, y: player.y });
58
},
59
action: {
61
60
up: function () {
62
if (lastAction != ActionEnum
63
.down) {
64
velocity.x x = 0 ;
velocity.y y = - 1 ;
65
}
66
},
67
down: function () {
68
if (lastAction != ActionEnum
. up) {
69
velocity.x = 0;
70
velocity.y y = 1 ;
71
}
72
},
73
left: function () {
74
if (lastAction != ActionEnum
.right) {
75
velocity.x x = - 1 ;
76
velocity.y y = 0 ;
77
}
78
},
right: function () {
79
if (lastAction != ActionEnum
80
.left) {104103102trail.length1011009998979695949392919089888786858483825081
4G
50
velocity.x = 1;
82
velocity.y = 0;
83
}
84
}
85
},
86
87
RandomFruit: function () {
88
if(walls) {
89
fruit.x = 1+Math.floor(Math .random() * (tileCount-2));
90
fruit.y = 1+Math.floor(Math * .random() (tileCount-2));
91
}
92
else {
93
fruit.x= Math.floor(Math .random() * tileCount);
94
fruit.y = Math.floor(Math .random() * tileCount);
95
}
96
},
97
98
log: function () {
99
console.log('
100
console.log('x:' + player.x + , y:' + player.y);
101
console.log('tail:' + tail + ', trail.length:' + trail.length );
102
},
103
loop function (){
104
() if = ! && :8150
Gana
Gama
Please sign in to leave a comment.