R0J0hound's Recent Forum Activity

  • You can find a equation by googling the distance between a line and a point.

    If a and b are the two points of the diagonal and p is the other point then the distance from p to the line would be:

    Abs(((P.x-a.x)*(b.y-a.y)-(p.y-a.y)*(b.x-a.x))/distance(a.x,a.y,b.x,b.y))

    Edit:

    Oops you wanted y distance, that would be this:

    Abs(Lerp(a.y, b.y, (P.x-a.x)/(b.x-a.x))-p.y)

  • jobel

    With 8 instead of 4, then with one ray it would do twice as many intersection tests.

    In general if there is no culling, the number of intersection test will equal=

    (number of rays) * (number of image points)

    So if you increase either then the amount of time will increase proportionally.

  • Yes you can, it becomes much simpler to do physics when it's just in a line like that.

    The motion is simple: increase the speed with gravity and move down with the speed.

    Collision detection is done by looping over the blocks from the bottom up. If the current block overlaps the block below push it up and set it's speed to the speed of the block below ...and repeat.

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

    ps. the speed change isn't physically correct when the objects collide. The actual speed of both blocks after a collision should be the average of the speeds, but it would add some complexity to the events.

  • looking at it again you'll probably want width>400 since by subtracting from the width it should be shrinking.

  • Repeat 1 means the animation is played once. I tested using 0 instead and it's the same, so it would seem 1 is the minimum number of times an animation will play thru.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For that simple case, yes.

  • 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.

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 157 followers

Connect with R0J0hound