paxclara's Forum Posts

  • It would, but the other families the sprites are in couldn't refer to them (and I agree shouldn't be able to, that would be weird.)--platforms is a family that responds to wetness by changing its surface type variables, plants would want wetness to know they've been watered. Each object type could individually respond to the variables, but I already have like *checks stats* 1700 events so I'm trying to keep my code from getting too complex... or uh, trying to keep my code relatively lean anyway. Like platforms would be alright, but I'm expecting to have 3 dozen kinds of plants, probably similar amounts of animals, fungi, enemies, etc.

    I think what would best serve my purposes is like hierarchies of families, and then I could put every sprite that's like "in the world" under one family that would hold wetness, and then plants and talkables would be a subfamily of that, and carryables a subfamily of talkables (and groundPlants and treePlants subfamilies of plants, which would help with another similar problem, etc). I imagine that would be a significant rework of construct's code base, though? And I mean, if I'm the only one who would ever use it, I'm happy to do my workaround--it's not that annoying (though it's a bit confusing in some instances--like in the aforementioned thing with the cats, sometimes the carryable needs to inherit the type from the talkable's name, and sometimes the talkable needs to inherit the name from the carryable's type. i've already resolved this one, it's just an example)--I was just wondering.

    No, you cannot make truly universal instance variables in object-oriented programming.

    ok i got kinda heated at this one i won't lie, but seeing it could be ai generated cooled me off.

  • Alright, I'll take that as a no and keep doing the workaround. Though to be clear I wasn't asking why families can't refer to other families variables--I didn't think they could (or should) do this. I was asking if I could put a variable on say every single sprite object type so they could universally be referred to (again, the same way that sprites all have sprite.X, and a family of sprites can refer to it as familyName.X in conditions/actions/expressions--an individual object can have its X set by referring to its object or any family it's a part of, and every family can freely use its X to make conditions) or if there was some other way to do it maybe. Thanks!

  • Thanks but I was not looking for help about the cats and NPCs. It needs to know the cat's and NPC's names for drawing the correct cat or NPC, and for talking to them. Cats are both carryable and talkable; they're in both families. Object type name does not work for my purpose at all.

    They all use wetness for different things; animation, particles, figuring out the platform's surface type (for playing sound effects and affecting movement physics), behaviors related to freezing/burning, etc. I can give every family wetness but it gets annoying if something is in two families because they need different names. I'm only asking if there's a way to add instance variables to for instance every sprite, which the engine will know every sprite can have (similar to how every sprite has a sprite.X, sprite.Y, etc.) and so can be referred to under any family. I already have a workaround, but I'm just checking if I can avoid working around it.

  • I keep running into problems where I need multiple families to know about the same information.

    For instance, I have sprite objects for NPCs and for Cats, which both need to know their own names and types for drawing animations, and their names for talking to them. This is held in my "talkables" family's instance variables. However, I also need to know the Cat's name when you pick it up and carry it around, which is information held in the "carryables" family's instance variables. Right now I'm just setting carryable.name to match talkable.name, which works fine (though it's a bit ugly in code.)

    I just ran into another problem where objects need to model wetness, but I'm looking at lots of families (platforms, groundPlants, animals, etc) that all need to store wetness. I'm just curious if there's some way to set universal object variables that families and object types would always be able to refer to in expressions?

  • I wouldn't recommend taking legal advice from a public web forum. There very well could be a problem with what you're describing. I assume what you're describing would be considered a derivative work, which provides very minimal protections if someone were to pursue a lawsuit for say AI art derived from their style. Enforcement situations are fluid and subject to more complex interpretations of the law, which include previous case work and court rulings. This will continue to be the case even if copyright law referring to AI art is updated in your country.

    I would not recommend using AI art primarily (edit: from a legal perspective, for the reasons mentioned above. i don't recommend using it personally, either, but that part is up to you). If you're using it just to generate ideas and then drawing your own fireball sprites, that wouldn't be considered a derivative work under US copyright law--only if you use portions of other published works (for example, sampling a song, or downloading a png of say a film poster or screen, or art from someone's social media, and using a portion or the entirety of that art in your game, even with modifications.) The actual enforcement of derivative works depends largely on the decision of the person or persons whose work you are sampling. Again, I am not a lawyer and you should not seek legal advice on public forums.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I went through several different phases working on my game, so here are a few ideas and what I ultimately did:

    first, you could use multiple particle objects line up across the top of the screen. you can mess with the X and Y offsets on the particle object itself to do the effect you're looking for, I think.

    for keeping them outside, I was having the particles destroy themselves on collision with solids. you can use collision filters if you want them to go through certain things. this requires you to actually generate objects rather than particles, and ultimately it created a ton of slowdown.

    what I ended up doing was rather than destroying the rain, just have the raindrop teleport itself back to the top of the screen and start falling again. this fixed the processing speed, which I think was mostly just from rapidly destroying and creating new raindrops. randomizing the height it teleported to gave it enough variation to not look super organized, which was really important. I actually ditched the particles entirely and just spawned objects in a loop based on how heavily it was raining (using wait commands to ease the rain in, and randomness to destroy the drops when the rain was supposed to stop). this also meant I can make platforms wet and water plants with rain or have it do other effects. my rain is sprites with bullet behavior.

    I tried a lot of effects, and I think ultimately changing the angle too much looks weird and unnatural--rain mostly falls in a grain in a localized area. think of looking into a streetlight in the rain at night--you can see that the rain is mostly similarly angled, so minor variation is okay but major variations is not so good.

  • augh!! nevermind, I got it. there was a platform that wasn't making its own plants so it just kept grabbing the most recently created plant and repeatedly setting its values. not sure why it was happening for multiple platforms, but I fixed it anyway.

  • hello,

    I have this block of code. it's a loop on start of layout for a platform to generate all of the plants on it. the plants then are added as children to the platform, and they have their height set by the platform. for some reason, the last plant a platform generates does not inherit the height (certain platforms always have the problem, but others do not), and has height 0. this happens even if I set the default height to be 1, so I'm assuming it's returning 0, but I have no idea why it would--you can see in the comment I was having a similar problem referring to another variable on the same object. is it somehow unpicking platforms? but why would it be set as a child correctly then...? and why would it work for n plants but fail on the last one?

    the platform's plantHeight is 3 even after it's finished loading. t1h3w2 is the default animation for this plant. it also happens with other object types which are groundPlants family as well. if I replace the variable with a number it works fine. I can just set everything at the end of the loop by picking all of the platforms's children, but I think this is the same problem that's making me have to use the 20 value instead of referring to a variable on the object which I would greatly prefer, so I thought I should ask anyway.

  • sorry, my initial post was kind of irrelevant because i didn't understand your system.

    so, the first thing i would recommend is to read up on containers in the manual.

    i would make one object type to represent all of the equipment, and then give that object type a variable that holds what it is and one that holds where it can be equipped, as well as a variable that holds how big its inventory is.

    then i would put that object into a container with an inventory array, and set the inventory array's size to the item's size in an event.

    this will simplify your code base dramatically because you won't need to use families--all of the equipped inventory can be picked at once with your "on the player" variable

    once that's done, it seems like you already have the basic setup done: gear has an associated array that can hold N items. now you have to draw the items, which you can do with a (fairly complex, tbh) nested set of for loops, one for each equipped item, and one for each entry in the equipped items array.

    item is "on the player"

    for each item

    -----create itemIcon at x = loopindex*25, y = 300

    -----itemIcon set animation item.Type

    -----inventoryArray for each X element

    ----------create itemIcon at x = item.X+10, y=310+(loopIndex*10)

    ----------itemIcon set animation inventoryArray.At(inventoryArray.curX)

    this would draw all the items vertically below the equipped item, if you set up the itemIcon to hold 1 animation for each item name.

    i hope that helps you move forward!

    edit: sorry i don't know how to render the tabs correctly

  • That does seem to be the case yeah. Never would've even known.

  • thank you so much!!! I spent like 45 minutes looking for it before posting, never thought about checking other plugins! now I feel silly

    just for the record if someone needs in 4-5 years or whatever, what I was looking for specifically is PlatformInfo.CanvasCSSWidth

  • i did this by making a dictionary for gameKeys and gameActions, and then at the top of my main event sheet have a giant bundle of or block events that check if a keyboard or gamepad is pushing one of the relevant buttons:

    when the game starts as part of my init function it loads all the default gameKeys from a dictionary project file, but you can change the key codes at runtime by using the LastKeyCode expression. i haven't actually implemented this yet because i'm not sure of the UI, so i don't have an example to share, sorry about that!

    so all "on key press" actions are replaced with "if gameActions key 'down' is 1" and all "key is down" actions are replaced with "if gameActions key 'down' >= 1" and such.

    (these r collapsed)

    this also meant i could keep track of how many frames each key has been down, which i used to implement DAS or auto-repeat with this function:

    i also frequently add 1 to the relevant gameActions if, for instance, you're in the menu and push "confirm" so that it doesn't automatically confirm when the next window opens as well

    i'm actually pretty proud of this one (i love that i was able to implement auto-repeat like that tbh) but i do agree it was kind of a bummer it was so roundabout. i hope my code helps, lmk if you need clarification!

  • I'm making a pixel art game with a small base resolution (640x360) with "letterbox integer scale" Fullscreen mode selected. I actually want it to be a bit more zoomed in than it is, and also want to use zoom effects that resolve onto integer scales (that is, that 1 pixel in the small resolution turns into an integer amount of pixels at larger resolutions evenly everywhere on the screen).

    My problem is just that I can't figure out how "zoomed" the actual window is--I would refer to the canvas size, but I can't seem to find an expression that refers to the canvas size in the engine, even though it's tracked in the debug menu (though it *does* have the default canvas size expressions.) is there some other way to do this I haven't considered or am not seeing?

    for instance if I fullscreen my game I know that the zoom is 4x (bc I know my resolution is 2560x1440), so I can add or remove 1 pixel width to every "base pixel" by changing the layout scale by increments of 1/4. obviously I won't know what resolution my players are playing at, so I want to be able to do it programmatically, with units of, say, 1/zoom, or something like 1/(canvasWidth/640). I just can't find the expression.

    Tagged:

  • tmx is a file format created for tiled map editor as far as i know, so you'd use tiled to make a .tmx file: https://www.mapeditor.org/. i used tiled to make all the maps for my first game and thought it was pretty useful and intuitive.

  • also curious about this. i don't know if this would be otherwise helpful, but i used this tool: yal.cc/r/20/pixelfont to make my own pixel font into a woff but it's still a bit ugly, especially at small resolutions

    the 2560x1440 version looks okay, you gotta squint to really notice it at least. but that's only really helpful if you can make your own font anyway, which isn't the case if you're using chinese or other character sets.