Yttermayn's Recent Forum Activity

  • Ooh, ghost. Now THAT looks helpful. Thank you!!!

  • Good info, thanks. I'll see if I can change things around to give the new instance a chance to appear before the check. Ill also look into families. Thank you!

  • Say you are creating and randomly placing several instances of the same base object. How would you detect an overlap between the current (picked) instance and another instance previously placed?

    I tried the obvious condition "Object is overlapping Object" condition, but it never triggers, though overlaps are definitely happening.

    Edit: I should mention that the objects are being created in a loop, so detection should go in there.

  • Is there a way to change the origin during runtime?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok, so I've figured out a better way to do this, for anyone trying the same thing:

    Forget bordering with sprites.

    Set up an event to test for overlap of your player and your room you want to contain him in. Invert it. Now four lines in this event gets us what we want: 1) start ignoring 8 direction input 2)stop 8 direction 3)move 10 pixels at angle = player.angle+180 4)stop ignoring input

    Now here's the trick, to get it so that the player sprite doesn't completely leave sprite before the event runs, you make the sprite size about twice the size of the actual graphic. So if your player is a 32x32 image, paste it into the center of a 64x64 blank image so he has this empty border around him. Then open that player image up in the C2 image editor. Change the collision polygon into a tiny box or triangle or whatever on the right hand side of the image (since C2 treats the right side as the forward side.) Now exit the image editor. What we've done is put a tiny little spot that moves in advance of the player's sprite that will set off our custom collision detection early, bouncing the player back 10 pixels whenever he tries to leave the containing sprite.

  • This is related to previous discussion here: Invert solid + 8 direction

    Basic thing Im trying to get to work: a randomly generated dungeon made up of decals of premade rooms. Problem: collision detection to keep the player within the rooms.

    People kept saying in the first thread to border the sprite that I want the player to stay on top of with other solid sprites that are pinned to the base sprite. This works great. However, what I didn't say is that this base sprite may have several instances of it spawned at runtime. This would totally blow the bordering method up. Except that I discovered you can make container objects that hold other objects so that they are created, destroyed, and otherwise affected together as if they were one object. Yay! Except there's at least one snag- while angle of the original objects in the container is retained, the position relative to the container object is not! Boo! One of several questions I have is: how can I make that position stay as well? I tried storing the x and y offset in a pair of variables stored in the original solid bordering wall sprite, to be retrieved by each instance of that wall sprite when the instance is created. That works well, until you need more than one wall.

    To make matters worse, there will be more than one kind of room.

    Basically, each wall that is added complicates things, and each new room type multiplies that complexity. The only thing I can think of is that each room type has a several unique wall objects that are unique to that room- so we have massive numbers of objects now, each of which needs to be scripted to grab the positioning data from the original instance.

    Ugggh! Is there a better way to do this?

  • Never mind. I found it. Sheesh, I swear it wasn't there before...

  • I understand pretty well what containers do and are for. After rereading the manual entry for them, however, it is unclear to me how to make them. The manual refers to the "container category" in an objects properties, but I cannot find that entry. Are containers not in the free version or something? Is there some obscure setting that has to be ticked to make an object a container before the category shows up in any objects properties? What's up?

    Thanks.

  • But then the player is stranded and can't move back onto the sprite. I am currently pursuing this as a possible solution, but I have two problems: 1) I'll have to code getting the player back onto the sprite as if bumping into the wall (which I can do) 2)The overlap doesn't trigger until the player is COMPLETELY outside (ie, not overlapping at all) the sprite. I need to figure out how to make it trigger earlier so that the player appears to be contained within the sprite. Not sure how to go about doing that yet. Maybe something involving image points.

    OlivierC Yes, I am aware of pinning and use that method to contain the player quite well in a different project. However, for reasons more complicated than I want to get into now, it is not a viable solution for this particular application. Just trust me on this.

    Yeah, I am aware of the danger of reinventing the wheel. Trying to avoid it. However, often I find that there are options and methods that I am not aware of that folks on this forum can point out.

    Thanks!

  • It occurs to me that I could use an inverted overlap condition; that then disables 8 direction, kicks you in reverse a little, then re-enables 8 direction.

    Any thoughts?

  • Thanks, but: " so bordering the sprite with other solid sprites is out"

    Already gave this idea plenty of thought. There are other reasons as well, which I won't go in to, but trust me, that option is out.

  • If there isn't a way to do this I may have to delve into the custom movement behavior, but it's worth a shot. If I do, is there a custom movement already written that is similar to what I want, or like the 8 direction movement that I can then adapt instead of reinventing the wheel?

Yttermayn's avatar

Yttermayn

Member since 3 Feb, 2013

None one is following Yttermayn yet!

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies