linkman2004's Forum Posts

  • You'll likely run into picking issues here, but that doesn't appear to be the case at the moment. Notice that the objects not shown as touching another object are in the bottom right of their respective groups. This is because you're only checking for an overlap towards the bottom right, so objects in the bottom right find nothing. You'll need to check for overlap in a few more directions to cover all your bases. For example:

  • Your best bet would be to use "Is overlapping at offset" with a small offset, perhaps 1. This way you can have objects that aren't actual colliding or overlapping, but can determine their proximity and direction to one another.

  • This isn't the right place to use "Trigger once" -- distance traveled won't magically reset after your bullet goes 50 pixels, so the condition is true and remains true, thus trigger once runs exactly once, as designed.

    What I'd recommend is to give your block an instance variable, called "spawnCount", perhaps. Then do something like this:

  • You're going to have to be more clear about what you want. Do you have any visual examples?

  • I went ahead and pulled together a tutorial explaining a more advanced version of this movement. No bounds on speed, support for unlimited objects, and objects following the path are guaranteed to go through the center of each waypoint.

    Path Movement Tutorial

    I'll leave the implementation in your game to you, but I highly recommend studying the CAPX provided in the tutorial. It utilizes some more advanced strategies, but everything is commented, and it will do you a world of good if you fully understand why it works.

  • Destroying all instances of an object won't unload the associated images. If it did, creating an instance of that object again would require reloading the image, which takes time.

    In any case, you shouldn't have to worry unless you have an obscene number of unique images. If you have a sprite with 1MB of associated images and you create 100 instances of that sprite, you'll only need 1MB of memory for that sprite.

  • A sprite's angle value is automatically wrapped to keep it between 0 and 360. A way around this is to store and update a virtual angle in an instance variable, then set the actual angle to this value. I've modified your example to show this working.

  • You can't change layout size at runtime. If you need to change it dynamically, enable unbounded scrolling on your layout, then clamp your scroll values based on your virtual layout size through events. This should give you the exact same effect.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You're running the loop every frame, that's why it's endlessly generating sprites -- it's not the loop running endlessly. I'm guessing you want to create your objects when you start the game. In that case, add your loop as a subevent to an "On start of layout" event, which is an event under the system object.

  • Put any objects you want to destroy with taps into a family, then change your event to use that family instead of the sprites.

  • If they're the same object type, add "Pick top instance" from your sprite's conditions to the "On tap" event.

  • I can think of two ways this would be implemented in general, not necessarily with Construct 2.

    1. Use bluetooth to discover and communicate with nearby devices. Construct 2 can't do this as far as I'm aware, and I'm unsure of the feasibility of writing a plugin for it.

    2. Setup a remote server to exchange data. Every X units of time(5 seconds, perhaps) the player's device polls the service, including their own location with the request. The server takes that location and responds with a list of nearby players and their info. At this point there are a couple things you could do:

    2(a). Open a direct connection to nearby players using websockets and bypass the server once contact is initiated.

    2(b). Have the two clients communicate through the server, sending actions to the server as they happen and frequently polling the server for the latest actions of the other player. This would preclude the possibility of fast paced games.

    Construct 2 should have everything you need to allow for either of the methods(a and b) outlined in option 2. Just know that this opens a can of worms concerning privacy, as user data -- likely non identifying, of course -- has to be shared with and persisted on a server somewhere, even if only briefly. The fact that we're talking location data here makes the issue especially touchy.

    Actual implementation details would be complicated and depend a lot on what you ultimately want to do, so I'm just going to leave you with the general overview above. Hopefully that pushes you in the right direction, though.

  • The expression to get the angle is going to look exactly as I wrote it, but with the indices replaced -- no need to use atan. I can't give exact indices(depends on the controller), but if I had to hazard a guess I would say:

    GamepadIndex = 0

    XAxisIndex(Left stick) = 0

    YAxisIndex(Left stick) = 1

    XAxisIndex(Right stick) = 2

    YAxisIndex(Right stick) = 3

    ...

    The only way to find out for sure is to run tests. Set the angle of an object to the expression I gave with various indices and see what works.

  • Security cameras: Animations aren't the best way to go here. Instead, have one frame where your camera is pointing to the right and the origin is in the middle of the camera itself, then use the Sine behavior on that object to alter its angle. There are a lot of settings there where you can change how far it turns, how fast, etc.

    Path movement: There are a lot of ways you can do this. One simple way is outlined below:

    1. Give the enemy the CustomMovement behavior(remove the pin behavior, too).

    2. Have four invisible sprites representing up, down, left, and right.

    3. Give the enemy some intial speed through the custom movement.

    4. When the enemy collides with one of the direction sprites, adjust his speed to move in the associated direction.

    5. Place your direction sprites such that your enemy will essentially "bounce" from one to the next until he finds his way to the original position, at which point he starts all over again.

    There are ways to achieve more complex path movements, and ways to do it using fewer direction sprites, but I feel this provides a good visual explanation of one method.

  • All you really need for this is to get the angle at which your analog stick is pointing, which you can get using the following expression:

    angle(0, 0, Gamepad.Axis(GamepadIndex, XAxisIndex), Gamepad.Axis(GamepadIndex, YAxisIndex))[/code:1be38cjs]
    You would, of course, replace GamepadIndex, XAxisIndex, and YAxisIndex with the desired indices for the gamepad and analog stick you're wanting to check on.  After getting this angle, it should be pretty straightforward to point/shoot/whatever an object in that direction.