R0J0hound's Forum Posts

  • Use max() and it will stop exactly at 400.

    +-------------------+
    | sprite: width<400 | sprite: set width to max(400, self.width-10*60*dt)
    +-------------------+[/code:2ox87p20]
    
    If the value is increasing instead you can use min().
  • Google is in the business of collecting data. Data from everywhere it can get it's hands on, and as much as possible. In a similar fashion to this latest privacy violation, a few years back google got it's hand slapped for using it's street view cars to also collect data off of unsecured wireless networks. I don't know what their intentions were, but there's no reason for them to have it. They probably don't even know what to do with it yet. They'll figure that out later.

    That is just them taking information from us without our permission. Google already gets lots of data from us whenever we use it's products. They get data and we get services in return. After they get the data they analyze it.

    For some known examples:

    If you use google search they know your search habits and interests. Why? Well, to show you ads that appeal to you is one reason.

    If you have an android phone and you use google maps they know where you are and where you go. One use of that is so google maps can have an idea of the traffic speed and find a faster route around slow areas.

    Why they would want to listen in on you at you pc? Don't know, but they also has all sorts of data from you that we trust them not to inspect. Gmail is one example. Laws keep them from using some data, and even forbids even collecting it, but that doesn't mean they don't have it somewhere.

    Too bad this whole data collection is becoming more and more common. Governments do it, but lack the efficiency that a private company can have. Even Facebook, Apple and Microsoft are data collectors. We aren't as anonymous as we once were.

  • ninja'd but here we go:

    global number highest=0
    
    +----------------------+
    |                      | set highest to array.at(0)
    +----------------------+
       +-------------------+
       | array: for each x | set highest to max(highest, array.curValue)
       +-------------------+
    [/code:2it05qpz]
  • In short you don't put that code into Construct 2 (C2), it was merely for illustration purposes in the tut. Look at the pictures, that's C2's way to code. It is done from the event editor by clicking through the menus.

    Look here for how to code in C2:

    https://www.scirra.com/tutorials/37/beg ... onstruct-2

  • Well, you can have a global variable that specifies the language you want. Presumably you'd have an options screen in your game where the user can change it. Then in events you just check what language was chosen when you set text.

    global number language = "english"
    
    +--------------------+
    | language="english" | set text to "The good blue cat."
    +--------------------+
    +--------------------+
    | language="spanish" | set text to "El gato azul diablo."
    +--------------------+[/code:2y30xisx]
  • kmsravindra

    The purpose of the plugin is to draw stuff to a canvas. You can already read pixels, but anything more such as keeping track of the object's that were drawn to it isn't what the plugin is for.

    That said here is the color picking method:

    https://dl.dropboxusercontent.com/u/542 ... cking.capx

    Left drag draws a line and right click erases the line that was clicked on.

    It works by adding the endpoints of each line to an array, then drawing the line on the main canvas as normal, and on a second canvas, only thicker and with a color that maps to an index in the array.

    Then deleting a clicked on line is a simple matter of checking the color, deleting the array index that matches the color, and finally clearing the canvas' and redrawing all the lines left in the array.

  • 1

    Performance is likely not an issue with this. C2 is already very fast at loading layouts, and loading would be the only thing affected. Size may be a bit smaller depending how you store it, but it will be pretty negligible especially with only 20 levels.

    2

    You could do that, or use one of the array editors on the forum to get a json string to load in an array... There's lots of ways to do it, and not really any best way.

    Your example isn't the best reason to make your own level format to load. Layouts with objects placed with a snap to grid is perfect for a thing like that. But then again how many blocks are you talking?

  • No use a loop. ex:

    +--------------------+
    |Start of layout     | set array size to (100,1,1)
    +--------------------+
       |array: for each x| set array at array.curX to array.curX
       +-----------------+[/code:rz3kjviz]
  • If that's giving you zeros then the array may still be all zeros. Did you fill numbers into the array? The other way you used just gives a random number so you could get repeated numbers.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • kmsravindra

    Two ways I can think of would be either a math way or checking the pixel color.

    The math way would check the mouse position with all the elements such as lines and pick the closest one. You'll have to look up the math to find the distance from a point to a line. Other elements like arcs and curves would take some ingenuity.

    The color checking method would be done with another invisible canvas where everything is drawn the same except each line is a different color so you can just check the color to lookup what element it is. To make them easier to click you can make the lines thicker. Also the antianalyzing may cause issues with that method so you may need to do a pixel perfect version of each like the capx a page or so back.

  • kmsravindra

    You could draw an identical arc over it, only instead of black use white. A better way would be to keep a list of all the things drawn and then remove the arc from the list, clear the canvas and redraw everything from the list.

  • sqiddster

    It may be slower than iterative methods since calculating intersection points isn't too cheap. With many objects it would be a problem, so any techniques to cull objects you don't need to cast to should help. The main use I have for it is to find an exact point of collision, and also the angle of the edge hit (although that's not present in the capx).

  • Maybe use int() instead of round() in round(random(0,arrayFrame.width)).

    Using round() can cause frameArray to equal arrayFrame.width and trying to delete that index will have no effect.

  • If you want to go the racasting route, here's an example with a re-usable raycaster event group that I've been using. It only needs the Function object to copy over.

    https://www.dropbox.com/s/qfjyoluo4eo83 ... .capx?dl=0

    To use set the start and end points of the ray with "raycast.set ray".

    Then call "raycast.cast to" with the endpoints of every line segment you want to cast to.

    Then use the functions "raycast.get x", "raycast.get y" to get the collision point or the end of the ray line segment if no collision occurred.

  • you can use "time" which gives you seconds. On the plus side is it's a decimal number so you can get a time of 0.456 or something. To get milliseconds you can multiply it by 1000.