Dodge the Creeps: C#: Repo version. Tons of errors

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Rhinoid

Hey,

Wanted to play around with GoDot and see if this is a viable option to create some games in it. I read the get started docs and wanted to try the ‘dodge the creeps’ for .NET.
I downloaded the examples repo and in the mono folder there is a .NET version of the creeps.

However when just loading the project file and building I already get:

Package GodotSharp 4.0.0 is not compatible with net472 (.NETFramework,Version=v4.7.2). Package GodotSharp 4.0.0 supports: net6.0 (.NETCoreApp,Version=v6.0)

So after some googling I changed the csprj file to: <TargetFramework>net600</TargetFramework> which makes the thing build.
However I now get a lot of other errors:

       (CoreCompile target) -> 
         /Users/reinier/dev/godot/godot-demo-projects-master/mono/dodge_the_creeps/HUD.cs(6,26): error GD0201: The name of the delegate must end with 'EventHandler': HUD.StartGame. Did you mean 'StartGameEventHandler'? [/Users/reinier/dev/godot/godot-demo-projects-master/mono/dodge_the_creeps/Dodge the Creeps with C#.csproj]
         /Users/reinier/dev/godot/godot-demo-projects-master/mono/dodge_the_creeps/Player.cs(6,26): error GD0201: The name of the delegate must end with 'EventHandler': Player.Hit. Did you mean 'HitEventHandler'? [/Users/reinier/dev/godot/godot-demo-projects-master/mono/dodge_the_creeps/Dodge the Creeps with C#.csproj]
         /Users/reinier/dev/godot/godot-demo-projects-master/mono/dodge_the_creeps/Mob.cs(3,28): error CS0246: The type or namespace name 'RigidDynamicBody2D' could not be found (are you missing a using directive or an assembly reference?) [/Users/reinier/dev/godot/godot-demo-projects-master/mono/dodge_the_creeps/Dodge the Creeps with C#.csproj]
         /Users/reinier/dev/godot/godot-demo-projects-master/mono/dodge_the_creeps/Mob.cs(5,26): error CS0115: 'Mob._Ready()': no suitable method found to override [/Users/reinier/dev/godot/godot-demo-projects-master/mono/dodge_the_creeps/Dodge the Creeps with C#.csproj]
         /Users/reinier/dev/godot/godot-demo-projects-master/mono/dodge_the_creeps/Player.cs(19,26): error CS0115: 'Player._Process(float)': no suitable method found to override [/Users/reinier/dev/godot/godot-demo-projects-master/mono/dodge_the_creeps/Dodge the Creeps with C#.csproj]

which makes me wonder:

  • Is .NET ready for primetime with godot or would I would this be a world of pain for newcomers (I do know .NET which is why I would prefer it over some custom language)
  • Am I still doing something wrong, which makes everything magically work?

btw I am on a Mac. And I have .NET installed:

3.1.120 [/usr/local/share/dotnet/sdk]
6.0.300 [/usr/local/share/dotnet/sdk]
reinier (master)$ dotnet --list-runtimes
Microsoft.AspNetCore.App 3.1.20 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.20 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]```

Looking for ward to be able to play with Godot. It really does look great.



Additional:
I finished the whole tutorial and this does work without problems.
I diffed my code with the repo and it has tons of differences. It looks like they are out of sync, so I was unclear what causes one to fail and the other to work.
:bust_in_silhouette: Reply From: Moreus

My .csproj

<Project Sdk="Godot.NET.Sdk/4.0.1">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <EnableDynamicLoading>true</EnableDynamicLoading>
    <RootNamespace>Godot4Demo</RootNamespace>
  </PropertyGroup>
</Project>

net600 looks sus to me

before ‘dodge the creeps’ try make empty project and do some test scripts

Moreus | 2023-04-02 14:30

It was 472 beforehand so I used the same notation. I tried your notation and this works as well, but I get the same 5 errors.

Rhinoid | 2023-04-02 15:05

you can try my project GitHub - Wanfanel/Godot-4.0-Test-project and check how godot works for you.

Moreus | 2023-04-02 18:28

Thats really nice. I’m now going through the tutorial manually and this seems to compile fine so far. So I’ll continue this way. If I ever find out why the main repo gives errors I’ll put an answer here.

Rhinoid | 2023-04-02 18:33