Log In  
Follow
mimick
SHOW MORE

Cart #54379 | 2018-07-24 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

Hi ^^

I was stunned by the light effects of Dank Tomb but I wasn't able to understand how it works. (Before I've seen the hackernoon site).

Here is an attempt to run something similar on jelpi, but with another logic. The pro is that it could run with several sources of light at the same time, the cons is that it is way less efficient and it uses most of the SFX memory.
Maybe some basic games could still run it at 30fps, and maybe we could improve it a little.

The first step is done once at the beginning: we create a hashmap for the 16 possible colors and a level of light (between 0 and 4), the level 0 gives the normal color and higher level gives darker colors.
As a peek in the memory gives 2 pixels at once. I've made a hashmap for the 1616 possible colors and the 44 levels of lights.

Then in the _draw function, I paint the light sources, I first paint the screen to the color 4, the darkest level, so all is in the complete dark. Then I draw some concentric circles with colors 3, 2, 1 and 0 at the position of the player.

Once it's done, I copy all the screen memory to the adress 0x3E00, it uses a big part of the SFX memory and all the user memory.

Finally, I do the normal drawing of Jelpi and as a post process I peek every pixel of the screen and the light level and poke it with the colors taken for the hashmap.
It gives what you could see in the screenshot.

I don't know if we could improve it more ? Maybe by restricting the loop on the pixel on a smaller area and painting the rest in black ?

P#54380 2018-07-24 09:50 ( Edited 2018-08-08 02:33)

SHOW MORE


0.3

  • Add of a high score and a virtual keyboard to type your name. Thanks to @afburgess

Cart #24639 | 2016-07-05 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

0.2 Change log:
Option menu to change

  • The speed of the snake, from 5 to 100 in % of the maximum speed.
  • The dash in % of movements which increase speed.
  • The grow in % of movements which increase size.
  • The control (2 directions, 4 directions or only one direction for the ones who like challenge) ^^

The apples are less likely to appears close to the walls

The snake is now green, which is more realistic. ;)

The snake start shorter and doesn't grow as much as before when an apple is eaten.

Fast restart.

Enjoy! :)

Cart #23998 | 2016-06-30 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

0.1 Just a basic snake for my first game to begin softly.

The interesting challenge were to not save the entire snake coordinate but only the head and tail location + the path taken by the head (table of direction+pixel lenght).

Once we have this, use a blue brush which paint the snake head moving and a black one to erase the snake at the tail location.

To inclrease the snake size i've just set a timer for the tail to move, it is called at the game start and when an apple is eaten.

Now I'm planning to add a hall of fame and will try to save it in the cartridge rom if possible.

Edit: Use <- and -> to change direction.

P#24005 2016-06-30 16:31 ( Edited 2016-10-06 21:24)

Follow Lexaloffle:          
Generated 2024-03-19 06:35:36 | 0.075s | Q:19