Discuss Scratch

NickAdonidas
New Scratcher
3 posts

Scratch 2.0 To C-Sharp

Der community,

i found scratch some days ago and I found it really interesting. Some projects are very good.
But I'm a c-sharp coder so my question is can i convert scratch code to C-sharp code?

Best regards,
Nick Adonidas

Last edited by NickAdonidas (May 30, 2018 18:45:05)

Kano_Llama_Llama
Scratcher
32 posts

Scratch 2.0 To C-Sharp

Here's a project that may help you to create projects from scratch to C# for Unity: Link
Otherwise I don't think there is any known way to do so, unless the ST knows one.

Last edited by Kano_Llama_Llama (May 31, 2018 01:27:39)

Jonathan50
Scratcher
1000+ posts

Scratch 2.0 To C-Sharp

procd actually made a Scratch compiler that generates C# code. That's probably not what you're looking for, though.
NickAdonidas
New Scratcher
3 posts

Scratch 2.0 To C-Sharp

@Kano_Llama_Llama
No, not for C# for Unity. I want plain C# ;-)

@Jonathan50
I#m going to test it

Thank you guys very much for yor fast replies!

Best regards,
Nick
NickAdonidas
New Scratcher
3 posts

Scratch 2.0 To C-Sharp

@Jonathan50
Sadly this is an Exe-Compiler and not a source code converter to c# source code

Many thanx for your reply,
Nick Adonidas

Last edited by NickAdonidas (May 31, 2018 20:23:04)

hardcore_penguin
Scratcher
1 post

Scratch 2.0 To C-Sharp

Kano_Llama_Llama wrote:

Here's a project that may help you to create projects from scratch to C# for Unity: Link
Otherwise I don't think there is any known way to do so, unless the ST knows one.
yes
procd
Scratcher
100+ posts

Scratch 2.0 To C-Sharp

NickAdonidas wrote:

@Jonathan50
Sadly this is an Exe-Compiler and not a source code converter to c# source code

Many thanx for your reply,
Nick Adonidas
You're correct although it does generate C# code which then gets compiled to the exe. The C# code generated is not readily available as far as I remember and would not be particularly nice to read. The exe code is not obfuscated as far as I remember so you could probably de-compile it. TBH I don't see why you would want to go from Scratch to C#? I can only think you like the simplicity and immediacy of Scratch? If you want to write games in C# then I recommend using what I used as part of the library for the compiler which is monogame.

After years of not visiting Scratch I just happen to revisit Scratch and see this question?
smoshpoog1
Scratcher
16 posts

Scratch 2.0 To C-Sharp

hi im new here plz tell me i can convert scratch to C# in 3.0
-Infinite-Code-
Scratcher
64 posts

Scratch 2.0 To C-Sharp

smoshpoog1 wrote:

hi im new here plz tell me i can convert scratch to C# in 3.0
You should probably make your own new topic!
smoshpoog1
Scratcher
16 posts

Scratch 2.0 To C-Sharp

probably ig
gdpr5b78aa4361827f5c2a08d700
Scratcher
1000+ posts

Scratch 2.0 To C-Sharp

NickAdonidas wrote:

@Kano_Llama_Llama
No, not for C# for Unity. I want plain C# ;-)

@Jonathan50
I#m going to test it

Thank you guys very much for yor fast replies!

Best regards,
Nick

Well you need a game engine to run the c# in…
PeeCeeMasters
Scratcher
11 posts

Scratch 2.0 To C-Sharp


Well you need a game engine to run the c# in…
Nope! You can do it in Visual Studio Community, just make sure to tick .NET Development when installing.
Or, if you don't want to install things on your computer, search for an online C# compiler, though it has less features (e.g. no autocorrect, compile-time error detection, etc.)
This is the website I use for compiling C# online.
Greg8128
Scratcher
500+ posts

Scratch 2.0 To C-Sharp

You could, but you would run into the problem that Scratch is nothing like C#, so the converted code will look nothing like C# code.

For example:
define max (a) (b)
if < (a) > (b) > then
set [out v] to (a)
else
set [out v] to (b)
end

when green flag clicked
max (3) (5)
set [c v] to (out)

would probably be converted by a reasonably straightforward converter to something like:

class program {
ScratchVar out, c;

void max (ScratchVar a, ScratchVar b){
if (a > b) {
out = a;
} else {
out = b;
}
}

void main (){ // idk if this is correct, my C# experience comes from Unity
max( new ScratchVar(3), new ScratchVar(5));
c = out;
}
}

class ScratchVar {
// object which emulates the behavior of Scratch's data type, including comparisons, addition, etc
}

Obviously this is nothing like how C# should look.
gamerboy12366
Scratcher
15 posts

Scratch 2.0 To C-Sharp

and make it turn into a Microsoft visual studios file
ninjaMAR
Scratcher
1000+ posts

Scratch 2.0 To C-Sharp

gamerboy12366 wrote:

and make it turn into a Microsoft visual studios file
Please don't necropost

Powered by DjangoBB