Snake Game. Customizable

SnakeGame
Customizable: Color, size, separation, speed, radius and background.

1722931500773


InitializeGame

Initialize the Snake Game


StartGame

Start the Snake Game

component_method (8)


PauseGame

Pause the Snake Game

component_method (10)


ResetGame

Reset the Snake Game

component_method (9)


Speed

Set the game speed in milliseconds (lower = faster)

blocks (18)


HeadColor

Set the color of the snake head

blocks (16)


BodyColor

Set the color of the snake body

blocks (15)


FoodColor

Set the color of the food

blocks (13)


GameOverTextColor

Set the color of the Game Over text


Separation

Set the separation between squares

blocks (14)


MoveLeft

Move the snake to the left

component_method (11)


MoveRight

Move the snake to the right

component_method (12)


MoveUp

Move the snake up

component_method (13)


MoveDown

Move the snake down

component_method (14)


IsInitialized

Returns true if the game has been initialized

component_set_get (5)


IsPaused

Returns true if the game is currently paused

component_set_get (4)


IsGameOver

Returns true if the game is over

component_set_get (3)


CurrentScore

Returns the current score

component_set_get (2)


CurrentSpeed

Returns the current speed/difficulty level in milliseconds

component_set_get (1)


GamePaused

Triggered when the game is paused

component_event (6)


GameResumed

Triggered when the game is resumed

component_event (7)


GameOver

Triggered when the game is over

component_event (5)


ScoreChanged

Triggered when the score changes

component_event (4)


TriggerGameOver

Manually trigger Game Over.

component_method (15)


BorderColor

Set the color of the border lines.

The limits where the snake collides.


BorderCollision

Enable or disable border collision.

If true, the snake will collide when touching the edges, but if false, it can pass through and appear on the other side, and will only collide if it touches its own tail.


ResetCollisionCounter

Reset the collision counter.


MaxCollisions

Set the maximum number of collisions before Game Over (0 = disabled).


BorderCollisionEnabled

Returns whether border collision is enabled.


CollisionCount

Returns the current collision count.

component_set_get (2)


Collision

Triggered when the snake collides with a border or itself.

component_event (7)


Update: v1.2

  • A frame has been added to show the edge where the snake will collide.

  • The user can now manually call when the game ends or set the number of collisions after which the game will end.


v1.2 Oct 13, 2025.

SnakeGame.aia (100.5 KB)

joejsanz.joedevsnakegame.aix (17.6 KB)


JDK: 11
Minimum API Level: 21
Updated On: 2025-10-13T07:00:00Z

Built using: FAST-CLI v5.2.0-premium


Thanks.

7 Likes

Please provide example blocks, or an aia project, to show how the less obvious properties are set, and with what values.

1 Like

this extension have a custom canvas or some library java graphics ?

1 Like

this extension have a custom canvas or some library java graphics ?

A webview with JavaScript code,perhaps

1 Like

Ready, I have uploaded the aia project. @TIMAI2

It does not have any library, it does not need a web view, just an Arrangement, the game is offline, it is pure java code.

@CanalDTodoUnPoco_PC
@marco_tanzi

2 Likes

did you write that java code yourself or did you find that code somewhere in the internet? In case of the latter please provide a link to the source and credit its author

Taifun

No libraries, no other people involved.

I think that everything can be done without libraries, although it's more difficult, but not impossible.

It's difficult for me but I like it.

1 Like

Nesse jogo da cobrinha, o fim da partida ocorre corretamente quando a cobra toca na borda superior ou inferior.

Problema:
Quando a cobra encosta na borda direita ou esquerda, o jogo nĂŁo termina. Em vez disso, ela atravessa a tela e reaparece do lado oposto:
Se estiver indo para a direita, ao atingir a borda, reaparece na esquerda e desce uma linha, continuando o movimento para a direita. Esse ciclo se repete até que chegue à borda inferior e o jogo acabe.
Se estiver indo para a esquerda, o processo é semelhante, mas a cada retorno ela sobe uma linha, até alcançar a borda superior e terminar a partida.
Esse comportamento torna o movimento da cobra previsível e pode ser explorado pelos jogadores. Por exemplo: se a comida estiver posicionada na parte inferior, basta deixar a cobra bater na borda direita para que ela siga sozinha, linha por linha, até alcançar a comida, sem esforço do jogador.

A ideia parece ter sido implementada como uma forma de evitar que, caso o jogador pare de jogar, a cobra fique indefinidamente presa nas laterais. Assim, o jogo garante que ela acabe eventualmente ao tocar a borda superior ou inferior.
Porém, essa mecânica abre brechas para atalhos e estratégias fáceis, o que reduz o desafio e compromete a dificuldade original do jogo da cobrinha.

Comentário adaptado com ChatGPT

1 Like

Please add Left, Right and Up, Down buttons for controlling Snake because it is not easy to play by touching the screen

1 Like

Update: v1.1. Oct, 04 2025

2 Likes

Thanks You Very Much Sir

Tested the new Snake Game (v1.1) works perfectly!
The speed, color, and collision updates are all fixed and smooth.
If your old version gives errors, just remove it first before adding this one.

:snake: Great job, everything’s running fine now!

Please Check Speed Block Not Work Propper . I Want Slow Speed=10 But Not Work .

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Hi I Am Testing Your Provided .aia file Please Check Speed Control Block Not Work Propper please :pray:t4:

Thank you.

If you put smaller numbers, you will get more speed, if you want the snake to go slower you must put a larger number.

1 Like

Oooooooo

:snake: Snake Game Extension — Feature Request / Update Suggestion

Hi @Joejsanz,

First of all, thank you so much for creating this amazing Snake Game Customizable extension :raised_hands:.
I’ve tested it in my project and it’s working great. But I have a few feature improvement suggestions that can make this extension even more powerful and flexible:

:compass: 1. Boundary Wrap Feature (Like Old Nokia Snake Game)
Currently, when the snake touches any boundary, the game ends.
:point_right: I want to suggest an option where:

  • If the snake touches the left boundary, it should reappear from the right side.
  • If it touches the top boundary, it should come from the bottom side (and vice versa).
    :white_check_mark: This will make the gameplay more fun and classic, just like Nokia’s old snake game.

:turtle: 2. Speed Control Fix
Right now, even when the speed is set to 0, the snake moves too fast.
:point_right: Please make the speed truly adjustable from very slow (0) to fast — gradually increasing.
This will allow better difficulty control in the game.

:brain: 3. Custom Game Over Conditions
Currently, Game Over happens automatically on boundary touch.
:point_right: Instead of forcing game over on first boundary touch, please give developers control to:

  • Decide after how many boundary touches (e.g., 3 or 4 times) the game should end.
  • Or even manually trigger Game Over from blocks if needed.
  • Snake should also be able to self-collide with its body to trigger Game Over.

:toolbox: 4. Optional Game Over Behavior
There can be a block like:
SetGameOverBehavior ( "Boundary" / "Manual" / "Wrap" )
or
SetMaxBoundaryTouches ( number )

  1. Please Add Padding or Margin options in Game Layout Because When Food code in boundary corner then 95% time Game Over.

This will make the extension much more flexible for game developers.

These changes will make the Snake Game extension feel much more like a real classic snake game and give full control to the developer.
Thank you again for your hard work :pray:.

Best Regards,
[@Kabir_Khan]

1 Like

These are good ideas that could be added, thank you for the suggestions.

  • The speed is set by time in milliseconds, the less quantity you put the faster it will go, if you want it to go slower, you must put more time, more quantity of number, for example if you put 1000, that is 1 second, every second the snake would move.
1 Like