nosemeocurrenada's Recent Forum Activity

  • Yes.. again trigonometry

    tan definition:

    tan angle = opposite / adjacent

    atan is the inverse of tan, so

    angle = atan (opposite / adjacent)

  • Ok.. if you are interested on knowing more about this fun geometrical things, and have the time, take a look at the Euclid's Elements: en.bookfi.org/book/492577

  • Do you know pythagorean theorem? well, if you take a pythagorean triangle with a fixed hypotenuse, and a fixed origin point, and only draw the other point of the hypotenuse for every possible angle, you'll get a circle.

    Taking that on account.. your problem is easily solved, remembering trigonometry and that fun word 'sohcahtoa'

    h : hypotenuse, radio of your circle

    c_x,c_y : center of the circle

    a : angle of the circle

    sin definition:

    sin a = opposite / hypotenuse

    we can think of the opposite as the difference in y from the center, so we have

    sin a = y / h .. y = h * sin(a) , here i'm assumpting that the centre of the circle is 0.. i guess that isn't your case, so we just offset it

    y = h * sin (a) + c_y

    cos definition:

    cos a = adjacent / hypotenuse = x / h

    x = h * cos (a) + c_x

    so, here is your answer

    x = h * cos (a) + c_x

    y = h * sin (a) + c_y

    where

    h : hypotenuse, radio of your circle

    c_x,c_y : center of the circle

    a : angle of the circle

    x,y : your points

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi there, i'll briefly introduce the context of my problem.

    I'm using r119 on Chrome. r119 because when i updated to a newer release, some things that worked before didn't seemed to work, so i'll stay on r119.

    I'm working on a casino game, a roulette. I receive all the information that i need (money, state of the buttons, position and value of coins), from a server running on other computer.

    These days i've been struggling with construct trying to create the coins on runtime. I receive the command to make a coin and parse it's slot ID, and it's value without problem, but when i try to create a Coin with the System.Create Action, i get a headache trying to save some reference to that coin.

    Note: the old versions of the program are deleted, so i only'll remake them for the pictures

    First, i've tried to save the UID on a global variable and retrieve it immediately after creating the coin. pics:

    <img src="http://img593.imageshack.us/img593/8900/getuid.png" border="0" /><img src="http://img14.imageshack.us/img14/6949/greencreate1.png" border="0" /><img src="http://img94.imageshack.us/img94/6035/coinsfly.png" border="0" />

    ..and later reference it by its UID

    <img src="http://img32.imageshack.us/img32/5038/coinreferenceuid.png" border="0" />

    That worked really bad! Never put a coin.. after some debugging with the console, i found that construct only is capable of picking by uid the object on the next tick after its creation. So, i added a wait action, and then, it worked somewhat nice, only had troubles if i clicked really fast.

    However, the reference says that a wait action in a for loop only will pause the currently running thread. So, the for loop will begin executing again for the next iteration if you put there a wait action. I load the coins in a for loop because i need to load several coins at once in many cases, for instance, if the game losses connection, or the players computer unluckly reboots, when the connection restablishes, the game must continue where it was left. In that context, the multithreaded environment without any system-made semaphores, really scared me. Then, i looked for another approach. Added to the Conis' CoinID variable -1 as initial value, and picked it by that value. Pic:

    <img src="http://img543.imageshack.us/img543/7382/coinreferencecoinid.png" border="0" />

    Worked fine, until i began sending more than one coin at once. Then it failed terribly, only put the first coin. Ignored the rest at the picking by instance variable. I put a foreach to dump all of the coins to the console, and terrified saw that always were only one coin. Furthermore, i've logged this to the chrome console immediately after the pick all Coins condition

    Coins.PickedCount &" coins picked vs "&Coins.Count&"actual coins"

    and saw things like "2 coins picked vs 4 actual coins". This is where i'm stuck now, kind of desperate because of this weird behavior.

    Anyway, thank you in advance for taking the time of reading all if this.

nosemeocurrenada's avatar

nosemeocurrenada

Member since 10 Jun, 2013

None one is following nosemeocurrenada yet!

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies