Wertle's Forum Posts

  • Could you post a .capx or a screenshot of how you were trying to pick?

  • That is strange, I just straight up had it print out 416%6.4 and its output is 6.4 instead of 0. Maybe there's a bug when using modulo with decimal numbers?

  • Or you can make an invisible sprite called "Camera" and put the scroll-to behavior on that. Then you can manipulate it separately, perhaps keeping it just in front of the player when he's moving, etc.

    I've had good success using an invisible camera sprite with scrollto and the LiteTween plugin for camera work.

  • In case you have a situation where you can't use containers: If the objects pinned to the thing are all of the same type or are in one family, you could do as a subevent to your collision event:

    System -> Pick by evaluate -> Object: Object that is pinned to spritePlane -> Expression: Object.Pin.PinnedUID = spriteShot.UID

    That should pick all the things of that Object type that are pinned to the sprite you collided with. If you have multiple object types pinned, then it gets a bit messy, as you'd have to do a different pick for each Object type or stick them in a family.

    Just make sure to Destroy spriteShot on a subevent after you do all the picking.

    EDIT: Here's a .capx illustrating this idea

  • I have a similar setup and did more or less the same thing (door has SwitchID variable that will hold switch's UID and vice versa), but I did an extra step to skip the tedium and error-proneness of entering all the IDs by hand.

    I made an invisible sprite called "linker" and placed it in my layouts connecting the switches to the doors. Then on layout start, I loop through all the linkers, pick the door and switch that it overlaps, and set the ID variables there.

    Then I delete the linker sprite since it's unused except at initialization. This was handy for me since I'm a more visual person, so being able to see in the editor which doors were linked to which switches was helpful.

  • In this particular case, the point at which I'd like to check is after a relatively complex pick of the same instance type, so it would be convenient to be able to do so.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Is there way to get the count of a certain subset of instances without picking them?

    Like, if I wanted to get the number of sprites with instance variable x set to y to use that number in a comparison, could I do it without actually picking the instances and using PickedCount?

  • I just realized that in spite of being on the forums off and on for nearly a year, I've never posted an introduction :O

    I'm Wertle, and I've been a professional game developer for ~5 years now, working primarily in the AAA space. Before working in games, I worked in the theater, worked as a web app developer (back when a web app was something made with PHP and mysql), and did general art and computer science type things.

    I learned about Construct 2 from this blog post on a developer blog to which I contribute. I use Construct 2 primarily for fast prototyping and for doing game jams and personal side projects, where getting an idea up and running fast is really important and where this program shines. I have a personal license and also convinced my company to get a business license to use it as a prototyping tool among other things.

    Happy to be here!

  • Just to follow up, tokenat() is used if you want to break up a string that is delineated by a common character. So for example, if you had a string that was like "coffee,tea,cakes,biscuits," that is delineated by commas.

    If you wanted to get, say, the third item in that list, you would do tokenat(list, 2, ","). That says "get me the third (remember indexing is 0-based, so it's 2 and not 3) object in the given string where the objects (or tokens) are separated by a comma"

  • In this case I don't think you need tokenat, just find()

    find(sentence, "tea") will return the index of the first time it finds "tea" and -1 if it doesn't find it at all.

    If you just wanted an event to check if it existed or not, you could do System-> Compare two values.The first value would be find(sentence, "tea"), then check if it is NOT equal to -1. The event will fire if the text is found.

    EDIT: Note, you have to be careful with this, because let's say you had the word "team" in your sentence. It would find "tea" and then return that it found something.

  • Sounds like you would need to get the vector of the wall facing and use that to calculate the new angle on collision, but I'm not sure if/how you can get that information.

    You may want to investigate the custom movement behavior's "push out solid" action.

  • Problem is i want to stop these all duplicate instances on their same Axis if any one of them reach in the middle of screen but it is not working it overlap each other till they don't reach in the middle of screen.

    Could you clarify what you mean by them overlapping each other until they don't reach the middle? I'm not clear on what is happening. If you could upload your .capx file it would really help.

    Also, how are you detecting when they've reached the middle of the screen? If you're doing it by collision with another object, you may need to add a "pick all" event to pick all the other bullet sprites. Otherwise your action will only affect the one sprite instance that did the colliding.

    I made an example here but I'm not sure if it's doing what you want from your description.http://storage.wertle.com/construct2/bulletThing.capx

  • One thing I do to sort of get around this is use a sprite called "Camera" with the scroll to behavior. I set this sprite position to my character when I want the scroll to on him, but if I need to cut away for whatever reason I can move the camera sprite. If I need to turn it off altogether I just destroy the camera, then spawn a new one and re-attach when I need scroll to again.

    This way you can still keep that handy shake :)

  • I was able to get this to work by putting the sprite into a family and then comparing against the family, like so. Would this work for you?

    http://storage.wertle.com/construct2/overlap.PNG

  • Wooo doing that makes the gamepad work! Yay!

    It's still bizarre that the other way has a discrepancy when using the gamepad. Do you think I should write a bug for it?