Recent

Author Topic: Simple Snake Game - Castle Game Engine  (Read 11397 times)

Eugene Loza

  • Hero Member
  • *****
  • Posts: 663
    • My games in Pascal
Simple Snake Game - Castle Game Engine
« on: November 07, 2016, 10:54:06 am »
This is an thoroughly-commented example of a very simple 2D game featuring:

* graphics with spritesheets,
* text output,
* keyboard/mouse input,
* read&write text files,
* sound & music,
* timer,
* Log,
* random

basically everything you might need to start making a simple 2D game in Castle Game Engine.

https://github.com/eugeneloza/SnakeGame
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Simple Snake Game - Castle Game Engine
« Reply #1 on: November 07, 2016, 12:52:17 pm »
Code: [Select]
  Rabbit := TRabbit.create(Application);

Great idea to let the snake eat rabbits.
Is this portable to real-life?

Bart

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: Simple Snake Game - Castle Game Engine
« Reply #2 on: November 07, 2016, 05:44:37 pm »
Good game!

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Simple Snake Game - Castle Game Engine
« Reply #3 on: November 07, 2016, 07:52:17 pm »
@Eugene Loza

You're good in writing games. Have you consider to write tutorials in the wiki page? It will be very useful for others. I can't find game tutorials in Lazarus tutorial page.

Eugene Loza

  • Hero Member
  • *****
  • Posts: 663
    • My games in Pascal
Re: Simple Snake Game - Castle Game Engine
« Reply #4 on: November 10, 2016, 12:25:18 pm »
Great idea to let the snake eat rabbits.
Is this portable to real-life?
I wanted to add sound on gameover (when the snake bites itself): "That's a well-deserved punishment for eating innoncent rabbits!" But eventually I've considered it too long :)
@lainz, thanks :)
@Handoko, Just today I saw some tutorials for writing freepascal games in youtube :)
Basically, yes. I wanted to make some sort of "introduction/tutorial" to writing games in FreePascal/Lazarus and Castle Game Engine, starting from the very basics like "Hello World" and ending with some complex 3D scenes and logics :) But not much progress yet...
As for me, programming is mostly about games. I'm not a professional game designer, but I strongly believe it's a cool hobby to have :)

P.S. I've updated the code a little. And I will also make the game portable to Android in the nearest time.
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Simple Snake Game - Castle Game Engine
« Reply #5 on: November 10, 2016, 12:50:34 pm »
"That's a well-deserved punishment for eating innoncent rabbits!"

What do you mean by "innocent rabbits".
They are destroying my property, and since it is illegal in this country to kill rabits, a rabbit eating snake would be most welcome.

Bart

Eugene Loza

  • Hero Member
  • *****
  • Posts: 663
    • My games in Pascal
Re: Simple Snake Game - Castle Game Engine
« Reply #6 on: November 11, 2016, 09:19:30 am »
I live in a city, so, I usually see rabbits as fluffy pets :) Or as animals grown for meat.
Quote
a rabbit eating snake would be most welcome.
In USSR we've had a cartoon based on "Treasure Island" book. It had a lot of funny songs, one of which stated:
"A tiny failure and now the same chance that helped you is the python and you're a rabbit. And python's mood is very dull :)"
https://www.youtube.com/watch?v=_iGIhXdKgu0
So, basically, yes. Pythons eat rabbits. But it'd be hard to solve the rabbit problem by a single pet python. I guess, it'll eat just one rabbit a day.
I'm not exactly sure, but I think there should be some ways to scare them off by noise-making devices...
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

Xor-el

  • Sr. Member
  • ****
  • Posts: 404
Re: Simple Snake Game - Castle Game Engine
« Reply #7 on: November 11, 2016, 10:13:07 am »
"That's a well-deserved punishment for eating innoncent rabbits!"

What do you mean by "innocent rabbits".
They are destroying my property, and since it is illegal in this country to kill rabits, a rabbit eating snake would be most welcome.

Bart

sorry for being inquisitive but do you mean you can't kill a rabbit for meat?

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Simple Snake Game - Castle Game Engine
« Reply #8 on: November 11, 2016, 10:19:17 am »
sorry for being inquisitive but do you mean you can't kill a rabbit for meat?
Of course you can do so. It is just not legal to do so in certain countries.

For example, in European countries they had to be very inventive to workaround such legislation  :-X

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Simple Snake Game - Castle Game Engine
« Reply #9 on: November 11, 2016, 12:11:25 pm »
sorry for being inquisitive but do you mean you can't kill a rabbit for meat?

In hunting season you can, but you cannot kill rabbits when they are an infestation (there are > 100 rabbits running around in my garden, making holes in the ground, causing my sheds to sink into the ground).

Therefore I would like to this snake game to real life.
Although, unfortunately, even in the game for every rabbit that's eaten, a new one pops up  :(

Bart

Xor-el

  • Sr. Member
  • ****
  • Posts: 404
Re: Simple Snake Game - Castle Game Engine
« Reply #10 on: November 11, 2016, 01:04:50 pm »
@molly and Bart, thanks for the answers.

@ Bart, I think you should inform animal control.

 

TinyPortal © 2005-2018