zatyka's Recent Forum Activity

  • Another option would be to create your own pinning system using events. You'd have to use a bit of trig, but it should give you the flexibility you need to position objects based on a loaded objects center origin.

    Having said that, I think GeometriX's suggestion of using an invisible object would work just as well, and be much simpler to implement.

  • I think I missed your attempt to use my method. I did a quick edit to your recent capx to show you how to use zones.

    Capx

    A few things to note:

    • The capx will seemingly only work for horizontal scrolling, but that's becasue you have the window size much larger than the playable area. My method works best when the zones height and width are equal or larger than the game's window size.
    • I had to change the some of the numbers in the scrolling event to correspond to your game's windows width and window height. I'm guessing this is where you may have run into trouble before. I changed the numbers to correspond to your game's window width and window height divided by 2. If you change your game's window size, you'll need to update these values. Alternatively, you could use the expressions "WindowWidth/2" and "WindowHeight/2" to set these, but as I recall, things can sometimes get buggy on certain full screen modes (thought that may have changed with some recent updates).
    • <img src="http://i.imgur.com/2xDnp8H.png" border="0">
    • Although I didn't test it, I'm sure ErekT's method would work fine. Personally, I don't like creating camera objects, but that's just me. One benefit of using the zone method is automatic transitions between zones.
    • A more detailed explaination of what the event means can be found approximately 2/3 of the way down this post.

    I hope this helps.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here's an example I made for another topic, but it should apply here as well. The method uses zones to define the camera's limits. The camera will follow the hero as long as it's within the hero's current zone.

    Demo

    Capx

  • You could just set the angle of motion to "angle(bullet.x,bullet.y,player.x,player.y)".

  • The math used in my demo isn't nearly as hard as it may look. Here's an explanation of what's happening.

    Let's start with the camera following the hero:

    <img src="http://i.imgur.com/BoztZOP.png" border="0" />

    Now we want to confine the camera to be within the zone the hero is currently in. Let's use the clamp expression to limit the scroll to positions:

    <img src="http://i.imgur.com/7yXTky5.png" border="0" />

    So what does this mean? Let's use the X coordinate as an example: clamp(hero.X,zone.X+160,zone.X+zone.Width-160)

    This expressions returns the value of hero.x as long as it's in between a minimum and maximum value. Otherwise, the minimum or maximum value is returned.

    When testing for minimum and maximum values, we need to keep 2 things in mind:

    • The origin of each zone is in its top left corner.
    • The width of the window is 320 pixels.

    Setting the minimum value stops the camera from going beyond the left edge of the current zone. It's set to Zone.X + 160. Zone.X is the left edge of the zone, and we must add 160 to compensate for half the width of the window.

    Similarly, setting the maximum value stops the camera from going beyond the right edge of the current zone. It's set to zone.X+zone.Width-160. Zone.X + Zone.Width is the right edge of the zone, and we must subtract 160 to compensate for half the width of the window.

    This expression alone will make a very choppy transition from one zone to the other, so let's throw in a lerp. This allows for smooth scrolling when changing zones.<img src="http://i.imgur.com/tmpDv7o.png" border="0" />

    Every tick, the lerp expression moves the current scroll 10% closer to the to the calculated scroll position (the result of the above clamp expression).

    I hope this explains things a bit more. Regarding non-rectangular zones, it's going to be difficult to have the camera scroll correctly around corners.

    <img src="http://i.imgur.com/ywIzEOP.png" border="0" />

    To accomplish this, you'd need a much more complex camera system, smart enough to recognize when it needs to move around corners based on the players movement.

  • Using the method in my example, you could overlap 2 zones for a T-shape, but the transition won't be as slick. It does get trickier if you want the camera "rails" to change directions smoothly.

  • I believe I understand what you're looking for. Here's one way to accomplish the effect using zones:

    Demo

    Capx (r131)

    The method I used will only work for rectangular zones. I hope it helps

  • There are family instance variables, but they're not quite the same thing.

    They function the same as far as I know. A family instance variable sounds like the ideal solution to the problem you described. Do you have a specific scenario where a family instance variable would not be a viable option?

  • You'd need some way of syncing real-world time with a source outside of the game. There are 2 plugins that get the system date an time on the user's computer:

    Clock

    System Date and Time

    If you're concerned that the user would cheat by messing with their system clock, you can sync with an external source to get the correct time, but this is a bit more complex. If you have your own server, you can get the time by setting up a simple PHP script. Then, within the game, ajax request the php page.

    Once you have a method of getting the current time, all you'd need to do is record the time the item is acquired, and destroy the item if more than an hour or more has passed.

  • I'm not at my PC, so I can't be 100% sure, but I believe you can double click an existing collision point to create a new one.

  • Hi almeidamarcell

    Did you mean to direct your request to hazneliel? I'm not sure what issue you're referring to. I never made a capx for this topics.

  • Joannesalfa & gillenew

    Thanks for the interest! I have made some good progress since my original post. However, work, family emergencies, and Ludum Dare 26 have been sapping the creativity out of me, and I haven't made much progress in the last month. I actually started working on it again over the weekend, and I'm hoping I continue working on it in my free time. Once I have anything I think is presentable, I'll be sure to make a post in the "My Creation" forum.

zatyka's avatar

zatyka

Member since 11 Aug, 2012

Twitter
zatyka has 1 followers

Trophy Case

  • 12-Year Club
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • x11
    Coach One of your tutorials has over 1,000 readers
  • RTFM Read the fabulous manual

Progress

15/44
How to earn trophies