zatyka's Forum Posts

  • It sounds like functions are the right way to go. Create a function for each template, and call one whenever it's needed. For example, create 3 functions, each with a different template, and name them:

    Template1

    Template2

    Template3

    Whenever the played reaches the point that new level elements need to be drawn, use the action:

    call function("Template"&Choose(1,2,3))

    This will call one of the 3 templates at random. You could also do something more dynamic, and add little variation to each template so the player doesn't recognize the pattern. You could go even more dynamic by using a single function, spawn all the objects, and randomly set their properties from a set of values. Of course, this may not be practical depending on your game play. Regardless, I think functions are what you're looking for.

  • As people have already said, there is no perfect resolution that will apply to all devices. That's about as concrete of an answer as you can get. The article that blackout09 linked to explains it clearly:

    common misconception is that you need to target a specific resolution, like 1280x720. However, there are so many different resolutions used that it's ridiculous to pick just one. It's much better to pick an aspect ratio, then scale the game to fit that. For example, instead of 1280x720, target the 16:9 aspect ratio. (Just enter any 16:9 resolution for the window size in Project Properties.) Enable Letterbox scale in the Fullsceeen-in-browser project property, and now your game should appear correctly on any 16:9 resolution. If the display is not 16:9 then black bars appear down the sides, which helps prevent unintended display issues like accidentally seeing too much of the level or menu screen. Note if you are designing a pixellated retro-style game, you may want to use Letterbox integer scale instead.

    his is the same problem faced by TV producers. There are many TVs out there using aspect ratios of 4:3, 16:9 and 16:10. If a producer films a TV show only in 4:3, on a 16:9 TV there will be gaps at the sides, or possibly even unintended off-set equipment and crew visible! Similarly, if you draw a background exactly fitting one display, then run it on another display with a slightly different aspect ratio, gaps will appear at the side or content outside the layout becomes visible. This can even happen if you simply don't take in to account the space taken up by the status bar on devices like the iPhone.

    TV producers solve this problem the same way you should: everything is filmed in the widest aspect ratio 16:9. Then for other displays it's cropped down. For your games, basically you need to make sure you draw your backgrounds wider (or taller, depending on orientation) than the window size, past the normally viewable edges, to ensure no gaps ever appear regardless of the device aspect ratio.

  • Same principle as shifting a value along the X Axis:

    ChangeX = Column to be shifted

    Shift Up:

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

    Shift Down:

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

  • zatyka , It would be a huge timesaver if this little detail was added ...

    It would be nice, but my solution works for the time being.

  • Whenever I create a function, I always save its name to a source, like an array, variable, xml file, etc. That way, I can reference that source whenever the function needs to be called so I avoid issues like this.

  • Since all citizens use an identical obstacle map, is there a way of calculating the map once, then applying it to all entities?

    When a path is found, you can access the X and Y coordinates of each node in the path using expressions. I don't know of any way to assign that same path to the "move along path" action, but you can use your own movement system to follow the path. Here's an example I made for someone else, but it should work for you too. The 2nd grouping in the capx is the one you're interested in because it saves the path to an array, which can then be used by other objects.

    Demo

    Capx

    Is there a way of adjusting individual collision map cells, rather than using the in-built "add object"/"re-calculate" functions?

    How exactly would you want to adjust them? I'm guessing you're looking to be able to specify a specific cell, and either change whether it contains an obstacle, or have it recalculate to check if it contains an obstacle. If so, I don't believe there is a way to do this.

  • TELLES0808

    No problem. I would have added your user name to my last post, but for some reason I thought you were looking for a solution for polygons and not lines. Anyway, I hope my demo helped.

  • Biino

    Windwalker

    It's not terribly difficult to find the intersection point of 2 lines:

    You can use each "line" object's angle and position to determine its straight-line equation. From there, use the two equations to solve for the same x and y.

    Demo

    Capx

    This method will only work for straight lines. Unfortunately finding the intersection point of polygons is a bit outside my mathematical comfort zone... at least for now. It would be handy if there was a system expression for LastCollisionX and LastCollisionY. I don't know how difficult it would be to implement, but I do know it's a lot easier to detect if polygons collide rather than where.

    You'd be surprised how often math is used in creating games. Knowing basic algebra, trig, and geometry has helped me on several occasions. If you're interested in brushing up on the subject, there's a myriad of resources online.

  • Ah, understood regarding the 2nd issue. You'd probably be better off regenerating the obstacle map whenever it changes instead of right before finding a path.

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

    Granted, it's more labor intensive due to the frequent recalculations, but it's probably the best solution at the moment. Now that I understand the situation, I agree that it would be handy to have the "On Obstacle Map Regenerate Finished"

  • 1. There are expressions to find the coordinates of nodes for an object's path. You can loop through each node, and save them to an array. Keep in mind, you'd only need to save them to an array if you want to save the path for some other purpose.

    Here's an example of using the bullet behavior to replace the "move along path" action. The capx actually has 2 examples. One is moving an object along its own path. The other is saving an object's path to an array, and then moving along the coordinates stored in the array. The second option would be handy to use when you want more than one object to follow the same path.

    Demo

    Capx

    2. I still don't think I'm following. I'm not sure what the difference between a trigger for "recalculating done", and a trigger of "on path found" is. If you're still having an issue, could you post a capx demonstrating the issue.

  • I can't speak to what program would be best to animate the bars.

    As far as displaying the animations in C2, I agree with newt that it gets tricky without an option to animate tiled background. You could create different tiled backgrounds for each frame, and create your own animation system using events, but that solution is pretty ugly. Another option would be to do something like this:

    Demo

    Capx

    I'm using a sprite for the bar's animations, and a masking sprite on top of it. Changing the width of the masking sprite makes it appear as if the animated bar is growing. It's also kind of ugly, but it may work for you.

  • Whiteclaws

    Sorry about that. Set ChangeY to the Y element you need to shift.

    To shift the Y element left:

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

    To shift the Y element right:

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

  • Example Capx

  • (A)(B)( )( )

    (B)( )( )(A)

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • All you should need to do is load the images as project files, and then call them using the Load image from URL action.

    Project Files