www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Made Game For the Raylib 6.0 Jam

reply Kapendev <alexandroskapretsos gmail.com> writes:
Thought I should mention it here too.
I made a 2D walk-and-hide-and-collect game using raylib-d and 
Joka for the Raylib 6.0 game jam.
Was a fun time overall. Mostly bug-free and the code is 
relatively clean compared to my previous jam games.
Repo: https://github.com/Kapendev/hex_merge_jam

[![image](https://img.itch.zone/aW1hZ2UvNDc3MDEyNy8yODQ0MTI1Ny5wbmc=/original/o%2FmkZL.png)](https://kapendev.itch.io/k-merge-with-me)

**Find The Bug Section**

```d
if (minutes == 1) text = "You played for...\n  {} minute\n  {} 
seconds",
text = text.fmt(minutes, seconds);
```
Jul 12
parent reply Dennis <dkorpel gmail.com> writes:
On Sunday, 12 July 2026 at 22:13:50 UTC, Kapendev wrote:
 Repo: https://github.com/Kapendev/hex_merge_jam
Screenshot looks really nice, took some time to find out how to play it :) I'd put the link to play in the GitHub README.md and in your post. https://kapendev.itch.io/k-merge-with-me For building the native `dub run` version, it's worth mentioning that raylib needs to be installed. Anyway, about the game. It's usually my impatience getting me. Once I would hide and wait more patiently for everyone to pass me, I completed it without much trouble. Getting lucky spawns also helps. Being able to wiggle the eyes while hiding is a fun touch.
 **Find The Bug Section**

 ```d
 if (minutes == 1) text = "You played for...\n  {} minute\n  {} 
 seconds",
 text = text.fmt(minutes, seconds);
 ```
I thought it was going to be that `text = x;` gets transformed to `text(x);` through property syntax, but what is that comma doing there and why does the compiler still allow this use of the comma operator?
Jul 19
next sibling parent reply Kapendev <alexandroskapretsos gmail.com> writes:
On Sunday, 19 July 2026 at 22:49:04 UTC, Dennis wrote:
 **Find The Bug Section**

 ```d
 if (minutes == 1) text = "You played for...\n  {} minute\n  {} 
 seconds",
 text = text.fmt(minutes, seconds);
 ```
I thought it was going to be that `text = x;` gets transformed to `text(x);` through property syntax, but what is that comma doing there and why does the compiler still allow this use of the comma operator?
Thanks for the tips and comments. The AI could be smarter, but I was afraid that people might find it hard to play. About the bug, yeah, it's the comma. The code does compile with it and it skips the fmt function if minutes is not 1. I think I used ldc41 something, but no idea. I need to check again.
Jul 19
parent Kapendev <alexandroskapretsos gmail.com> writes:
On Sunday, 19 July 2026 at 23:18:43 UTC, Kapendev wrote:
 About the bug, yeah, it's the comma. The code does compile with 
 it and it skips the fmt function if minutes is not 1.
 I think I used ldc41 something, but no idea. I need to check 
 again.
And by bug I mean I wanted to write `;` and somehow wrote `,` instead and the compiler was fine with it. Was a 5 minute search.
Jul 19
prev sibling parent reply Steven Schveighoffer <schveiguy gmail.com> writes:
On Sunday, 19 July 2026 at 22:49:04 UTC, Dennis wrote:
 On Sunday, 12 July 2026 at 22:13:50 UTC, Kapendev wrote:
 **Find The Bug Section**

 ```d
 if (minutes == 1) text = "You played for...\n  {} minute\n  {} 
 seconds",
 text = text.fmt(minutes, seconds);
 ```
I thought it was going to be that `text = x;` gets transformed to `text(x);` through property syntax, but what is that comma doing there and why does the compiler still allow this use of the comma operator?
Whoa. I too was confused but... I was trying it out, simplified version: ```d int x = 1; x = 2, x = 3; ``` This compiles and x is assigned to 3. So what is happening? It turns out the comma operator is lower precedence than assignment (one of the few). So this statement really is: ```d (x = 2), (x = 3); ``` So the actual result of the comma operator is not being used. If you change to: ```d x = (2, x = 3); ``` you will get the error. This kinda makes sense, considering the one place where we normally accept comma usage is in for-loops, and an increment clause can look like this. -Steve
Jul 19
parent =?UTF-8?Q?Ali_=C3=87ehreli?= <acehreli yahoo.com> writes:
On 7/19/26 7:49 PM, Steven Schveighoffer wrote:
 ```d
 (x = 2), (x = 3);
 ```
 So the actual result of the comma operator is not being used.
Yes, that was how the comma operator was crippled. As you say, it's still allowed if the value of the expression is not used. Ali
Jul 20