calling c# methods from construct 2

  • So first off...I'm new to Construct 2 by like 3 days and so far Im really stoked about it. I've see some stuff about ajax and rumors of .net wrappers, but I can't seem to find a straight forward tutorial on how to call .net from construct.

    I have a puzzle game I wrote in c# that has all the logic in a dll. I want to use Construct as the UI and keep my logic in the dll. Is this possible or am I wasting my time? <img src="smileys/smiley5.gif" border="0" align="middle" />

  • thagr8stone it sounds like it would be quicker to redo in Construct 2. If you check out my Windows Phone plugin you can see how I've called C# methods from Construct 2.

  • Umm...I it would be "faster" to whip together a new UI in took weeks to get the logic right and I just want to put a nice slick UI on it. I'm sure there are some pieces I'll have to convert (timers, UI clicks, etc) but really calling the dll is the best way to do what I want to do.

  • Any reason you're not just using a C# UI library? It seems a bit OTT to load an HTML game framework, superimpose it over your game via a WebView and then bridge HTML and native code manually.

    If you want to do this without a plugin, you could use the 'Execute JavaScript' Browser action to call native code from the webview.

  • Actually this is just to do a POC for my boss. If I had my way I would have just done all this in Xamarin Studio and went on with my life but I'm not in charge...

  • Create a restful service in C#, perhaps even a selfhosted WebAPI application (removes the dependency on IIS) that feeds data back and forth via JSON, and wrap your DLL method calls into the appropriate web api calls, which would then get called via the AJAX plugin. Seems rather straight forward actually...

  • wizaerd sounds like he has a better understanding of what to do :)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • LOL after a bit of reading wizaerd way idea seems like the best approach. It wouls be better if I could just load the dll directly but the web service way seems to be doing the trick. Thanks guys!

  • I agree with thehen as you already know the logic, and C2 makes implementing that much easier than regular code.

    I do remember reading about this:thing a while back. Another kind of wizardry all together.

  • You could have a look at sharpkit, a c# to javascript compiler, if you don't mind pushing the logic onto the client.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)