Help simplifying my code

  • I know there must be an easier way to set this up. I am spawning platforms that scroll to the left. Each platform has an instance variable which tells the platform weather or not it should have a box sitting on it and which type that box should be. The problem I am having is that I have to define each action for each platform. For instance, if I wanted to add a different box type, I would have to go to each platform setup and add that box type to it. It just seems like a waste of time, plus the code is getting really messy.

    I have attached a simplified CAPx of my project to this thread. My actual game is much more complex and has a lot more platform calls, but this should be able to illustrate my problem. Please help!

  • Not exactly sure what you're looking for. But sounds like it might be functions.

    https://www.scirra.com/manual/149/function

  • You don't need separate objects. Use one object with different frames. Then you just create the object showing the appropriate frame. This will make life much easier.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That's an interesting solution. I was thinking I would have to set up a loop of some kind. I'll try setting up one object with multiple frames and see how that works out. It should definitely reduce some of my code.

  • So far this is working great. Very elegant workaround, thanks for the tip Blackhornet!

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