HolidayExplanation's Recent Forum Activity

  • Yes the simple solution you kind of began then went for overlap checks. It's all about data and the gen ID is all you need. If the gen is down, you find all cables that have the gen ID and they are inactive. They are linked with IDs for this purpose, no need for checking overlap of objects.

    Why I went for overlap checks is because just powering all cables/relays depending on if generator with the id is running or not, is because if I only have data and disconnect a cable from a relay, it won't turn off all other cables but they will be active because generator is on. That's why I'm using overlaps to check for physical connections

  • Active true/false means that the cable/relay is connected to a generator that is turned on/off. The active doesn't change on cables/relays/machines without the recalculate_connections function, I tried that by checking overlaps every tick between cables, relays and machines. I might be making this more difficult than it actually is, I don't know, there might be an insanely simple system which could work and I'm not seeing. But, all the simple stuff I tried didn't work for me either...

  • C3 File: https://easyupload.io/vtbbr6

    What I'm trying to do:

    I'm trying to send electricity from generator via cables that can be connected to relays to extend the range and then be connected to machines that consume power.

    How I approached it:

    I need to recalculate_connections between generator, cables, relays and machines when a cable is created or a cable is destroyed and a generator is turned on/off.

    Each cable gets assigned the ID of the generator (gen_id) when created, when connected to a relay or machine it gets assigned the gen_id via cable reference. At creation of the cable on the generator (the first cable for that generator), it gets assigned cable_num of 0, when connected to a relay the relay then has cable_num of Cable.cable_num + 1, and when creating cable from relay cable gets cable_num of Relay.cable_num + 1.

    When I turn on the generator, function recalculate_connections runs to calculate which cables and relays are connected to the generator and are receiving power. It goes through the cables and relays checking for overlays and passing active = true. Then for each machine that overlaps a cable that has active = true, machine gets consuming_power = true.

    *Relays are the Component object with type instance variable = "relay" in the file.

    Problem:

    The ID assigning works, as well as passing the power until the cable of the second relay, then the cable remains active = false.

    I don't know how to solve this. If you know of a fix or a completely new system for this, I would appreciate it greatly since I'm stuck on this for months now and had tried around 15 different systems, none of which worked.

    Tagged:

  • I remember a couple years ago the only way to mod (as far as I knew) was TetroniMike's plugin for modding. I haven't yet used scripts in C3, is there a better, or even a way at all nowadays to do this with scripts or any other way?

    Tagged:

  • You do not have permission to view this post

  • That's exactly right and just what I needed! Thank you!

  • When I take an item from the ground, I position it on the GUI layer which has parallax (0, 0). Whenever the Character moves with scroll to around the layout, the position of the Item starts going away further and further from the Mouse.x, Mouse.Y position. I assume this is due to the parallax offsetting it.

    My code looks like this standard:

    Every tick -> Item set position (Mouse.X, Mouse.Y)

    Is there a way to get the parallax offset amount and subtract it from Mouse.X, Mouse.Y so that it looks something like this:

    Every tick -> Item set position (Mouse.X - parallaxOffset, Mouse.Y - parallaxOffset)

    Tagged:

  • Arrays only noticeably affect the performance if you do some heavy looping and if they're big. I use arrays mostly for inventory related stuff, because it's good to have a single central storage for all the loot across the player inventory, as well as any loot containers etc..

    Another thing I used an array for recently was calculating world temperatures for each hour and storing them into an array. So then you can access Arr.At(hour, 0). It makes sense for things like that. But when you need to store data like player variables - health, mana, stamina etc.., it's better to use 20-30 instance variables on the Player object, than an array, because it's hard to read an array, Array.At(0, 6) = mana... Maybe if you're a machine. It would be too hard to read.

    A biome system array won't likely have any performance impacts if you loop through it from time to time. It starts being critical I think after an array has a height over 10 and couple hundred width, then it can freeze the game for a second when you loop.

  • I think the closest to that would be an effect. Mikal has a reflection effect, maybe it's possible to do something similar with it; https://www.construct.net/en/make-games/addons/82/reflecty

  • You do not have permission to view this post

  • You need 2 conditions:

    Mouse -> on Sprite clicked

    Sprite -> Pick top/bottom

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Bless you. This time I'll keep a file of it, since I began collecting some generic files I created to stop repeating this over time.

HolidayExplanation's avatar

HolidayExplanation

Member since 27 Sep, 2015

Twitter
HolidayExplanation has 1 followers

Connect with HolidayExplanation

Blogs