paxclara's Forum Posts

  • I'm trying to add a rope that the player can swing around on in my platformer game.

    I chose not to use the physics system for this, because I wanted to figure out how it worked and I wasn't using the physics system anywhere else. For this, I'm mostly trying to emulate Umihara Kawase, a SNES game where the main action is in throwing a springy grappling hook to change your momentum--so I want it to move between swinging and platforming. from my research the physics of a simple pendulum seemed relatively straightforward, and I thought I could apply the acceleration by making two acceleration vectors every frame and applying them to her platform vectorX and vectorY

    the tension vector being (v^2)/r

    the gravity vector being gsinA.

    here's the code. it's under an else that first checks if the rope becomes slack, which moves her back to regular platforming mode (it actually doesn't really do anything right now though, which you can kind of see in the video)

    before we get here, she gets put into a movement state that removes all of her construct-platform behavior values; so she has no accel/decel/gravity and her max speed and fall speed are set to 2000 px/s. right now it also just kills her momentum rather than converting it into an initial vector, so she should behave as if the pendulum's bob was held up and dropped.

    the main problem is that she's actually accelerating even with no other inputs happening on her. i'm not sure why--as far as I can tell, the physics are right; I validated the trig is correct by duplicating it into desmos and seeing that the x/y components add up correctly, and this is all just the actual newtonian physics I got from reading about pendulums (and from my 20 years past physics classes). but maybe i'm missing something?

    here's a video showing this behavior:

    https://bsky.app/profile/did:plc:ym7kmpznqveevleoktwrxahc/post/3mdo7j4amcc27

    and here's a video where i removed the vertical component as well as the effect from tension, and then put a wall next to her. you can see that even in one swoop she accelerates further to the opposite side than the constraint on the wall-side:

    https://bsky.app/profile/sibylcybil.bsky.social/post/3mdoghtiqvc2b

    the second problem which i'm hoping will go away when I figure out what's wrong here is that it seems like the tension force isn't strong enough to actually maintain the exact length of the rope, so over time she'll be lowered down. I tried adding 1 accel to the tension for each width of rope over the max, but it made her retract too quickly. My guess is that the gravity accel is also too high for the y component.

    here's some thoughts i had but either were unrevealing or afaict dead ends:

    - the problem is i'm not measuring her accel infinitesimally, so i tried averaging 10 and 100 points between the previous and current radii of the rope and got the same result

    - thought maybe it was a result of her going around the corner of the block she's attached to, which changes the radius--which would in the real world change the rotational speed--but it happens even if she's attached directly and not rounding a corner

    - thought maybe it was a dt thing where the time was processing strangely but it's consistently 1/60 a second...

    - maybe it's a floating point thing but i can't investigate that directly and i would assume that would resolve out over multiple swings instead of getting consecutively faster

    - maybe it's a physics thing where i don't have a "simple" pendulum for some reason

    - there's also a disconnect between her position and the exact angle the rope is going to, but since it's fixed to an image point that isn't moving around i would think that probably isn't a factor? so i put it on her image point 0 and it still behaved this way (and also caused a bunch of other problems, that was an annoying test.)

    - thought maybe it's because the tension line isn't directly identical to the rope, since this happens before the rope is updated, but moving it to be after the rope update makes her sink downwards. actually i can't figure that one out really, so it might be revealing in some way

    Anyway, what am I missing here? I've been pulling my hair out over it for two days at this point but haven't changed the code at all (without reverting what I've done, anyway.) It really does seem like the physics should be correct, but maybe it's not? Maybe I'm missing something obvious, like using cos instead of sin somewhere? I just want more eyes on it at this point because I'm totally spinning my wheels.

    Tagged:

  • it has the permissions, though that was probably a good check. i think the problem must be happening somewhere else since like i said i can copy-paste inside of the editor, but i haven't quite figured out where still even though it's certainly in the clipboard somewhere. at first i thought it was a wine thing but it happens from native programs too.

    thank you for your help though!

  • I'm on ubuntu, with chrome, but can't paste images into the editor if I copied something from outside of it. I can copy/paste inside the editor, but I can't paste something copied from construct into other programs either. I was able to do this before switching to linux this month, so I'm wondering if anyone else has had this kind of issue and knows of a way to get it to work again. doesn't seem to be a chrome issue because I can paste into the searchbar and this text box like normal.

  • i was going for platforms you could jump up through and not fall down through, at least without a separate action or something to pass downward through them. i would be interested in having one-way solids that work in other directions--like solids you could pass downward through but not go back up through, and one way doors like in mario maker.

    i did try putting jumpthru and solid together on an object and switching between them, but i want the slopes to still be walkable for NPCs/enemies even if the player isn't on them--but actually, i do think this would work for bullets, which could have an exclusion list with every platform in the layout on it, so that they'd only interact with the jump-thru behavior and ignore the solid behavior of the objects. it would probably work for most of what i need from 8-direction behavior as well, since they're mostly just bouncing off of solids--i think the oddity of objects with platform behavior sliding through sloped jump-thrus is mostly from how gravity works with left/right movement. i think i have an idea of how to work this out so let me test it and see how the bullets end up working...

    edit: ah, so, the "bounce off solids" attribute of the bullet behavior, which i maybe should have predicted, only bounces off of... solids! it already does not bounce off of jump-thrus. i had apparently already ran into this because i had bullets checking if their angle was between 0 and 180 (ie downwards) and if so bouncing, which doesn't like *technically* work for sloped jump-thrus (an object traveling at an angle of -5 could collide with the top of a jump-thru at a slope of <-5--additionally many of my bullets are affected by gravity so they could arc inside of a jump-thru which might result in weird behaviors...) so i have to figure that one out still. anyway, i did give bullets an exclusion list by doing this, which they seem to obey:

    (note that my game has a "layoutMaster" object that's present on all layouts already, to hold information like whether the layout is "inside" or what angle it is at relative to compass directions, so it was easy to add the variable here--i imagine you could use a global string variable just as easily!)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • weird thing to say tbh, it's my game so why shouldn't i try to make things work the way i want? and it's just an example of the step thing i was talking about, where a more complex shape is too time consuming. like this one i didn't finish:

    and then there's this part:

    ideally i want to be able to have "jump-thru" peaks of pointed houses or steeples of buildings. also hoping to have one-way horizontal platforms that block movement from one direction but allow it from the other, which seems to be an overlapping (lol) issue. maybe i can figure it out, but for now i'm just wondering if anyone else has any insights or experience on this

    i want to have long slopes that the player can walk up. like this:

    super mario world did sloped "jump-thrus" in 1991 so i don't see why it would be impossible or i should limit myself if i can get around it. actually kind of surprised i wasn't able to find anyone dealing with this

    anyway, more constructively, here's my best solution so far:

    it handles long angles pretty well like this, and since player collision and all the other stuff that uses platformer behavior already has an "on fall" section for animation i could add this to them pretty readily. for the points i think i'll have to use sprite objects with platforms trailing to the side to get the effect i want (i use platform objects (they're 9-patches) instead of tiles with collision so that it can play sound effects, make particles, and change the player's movement physics based on the surface material, but i imagine it would work if you used tiles.)

    the last problem is i'm not totally sure yet how to handle 8 direction or bullets, which i have a lot of both, and definitely want my thrown objects to bounce off of them at the correct angles. i guess i will update when i figure it out but i still wonder if anyone has dealt with this problem before

  • i see in the manual that jump-thru does not support slopes, which does seem to be the case from my testing. what i'm wondering is if anyone has found a good work-around for this--searching the forum doesn't make it sound like something people have attempted much, but it doesn't hurt to ask, and maybe someone else could see my thought process later when they were also trying to do this.

    so far my best work-around seems to be to make a collision box that looks like this:

    since it has no slopes, and the collision seems to usually handle 1-pixel "steps", but i have fallen through it a few times. the main downside is that it's time-consuming to set this up, especially for steeper slopes or more complex objects. the other downside is that once you get more than 16 points, construct keeps telling me using too many collision points could lead to performance issues, which i definitely buy, but haven't personally tested. i also tried stacking jump-thru platforms which worked similarly but is also time consuming

    i also tried using a solid behavior and then doing this:

    but obviously this doesn't work, because once you collide with the thing it changes you to be falling, so it's impossible to evaluate what you were doing just before the collision, without saving your vectors every frame in an array to check against later--and then everything with platform behavior would be saving its vectors every frame, which i guess is possible. using "overlaps at offsets" actually let me pass through as desired, but also feels like it's going to cause performance issues at scale, and this exact method here creates a kind of jarring visual where it pushes you upwards through the platform

    these are just first attempts, and later i would expand them to families that include the various types of platforms i would need. ideally i want to be able to have "jump-thru" peaks of pointed houses or steeples of buildings. also hoping to have one-way horizontal platforms that block movement from one direction but allow it from the other, which seems to be an overlapping (lol) issue. maybe i can figure it out, but for now i'm just wondering if anyone else has any insights or experience on this

  • I have a flower graphic I want visible only when it's over another specific object. I thought I could use source atop blend mode but that makes it visible as long as it's above anything else--I thought it would be selective of only things on its same layer, which is what I desired, but I see why it's the way it is now. The graphic is a UI component and so is currently on my highest layer.

    Another acceptable solution would be to occlude part of the graphic, like so it only drew the portion of it below a certain Y level. but I'm not sure how to do that either. I am pretty much a total amateur when it comes to shaders so I'm still trying to figure this stuff out; there's similar effects I want to do that this second solution wouldn't really work for.

    The graphic is the flower in the bottom left of this screenshot, but I want to put it at the top so it's centered on the nameplate, but only visible when it's in front of the backing graphic (and doesn't cover the gameplay area.)

    Tagged:

  • 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.

  • 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.