openfocus's Forum Posts

  • tried your solution but i think i solved it another way:

    created object at circle.x, circle.y

    move object random(500,600) at angle random(0,360)

    repeat as many times as i need... did kind of work.

  • hmm ye that might work, thanks! i was trying to use a cos/sin but math > me =)

  • Hey!

    im trying to figure out a formula on how to spawn objects around a circle. i need it to be random X,Y but at a fixed interval in distance.

    so i want the red sprites to only spawn inside in the grey band. any ideas?

    PS. the grey band is not an actual sprite, only a visual example of the formula im looking for.

  • Hey!

    so i was wondering if this problem could be solved:

    in my project you can zoom in/out and i want 1 of my sprites to not change in size/scale, regardless of zoom level.

    ive been trying to use "set sprite scale -> set scale to" and figure out a formula to have it increase or decrease in scale 1:1 in relation to current layoutscale, but need help! maybe this is the wrong approach?

    btw, separate layer and scale rate = 0 is not a option because that changes the sprites relation to the other sprites when zooming =(

  • openfocus

    Here's a way to do it with the same formula I used before.

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

    A family was used so I can pick two different instances of the same object type. Also all the numbers are kind of arbitrary, e.g. G, masses, velocities and positions. I just tweaked them until I got an acceptable motion. However there is no reason why you couldn't use scaled values from actual planet data.

    that is amazing! thanks rojo!

  • awesome stuff

    ive been looking all over the forums for a couple days for solutions on how to do radial gravity(?). however all the examples i found have the bodies (planets/moons) only acting towards a central object (blackhole/sun) and ive tried to expand on the formulas but im not learned like R0J0 so i fail hard at creating a complete model where all the bodies interact with each other.

    what im trying to do:

    solar system with a star in the middle exerting radial gravity to the very edges of the solarsystem (layout). the star should probably not use box2d physics for mass as it would have to be impossibly huge, but instead get mass from an instance variable.

    orbiting bodies(planets) that do use physics and each have radial gravity depending on physics mass (calculated by radius right?)

    so for example in my fantasy version of this example it would be possible to place a large body in orbit around the star and a smaller body in orbit around the large body (ie both bodies are affected by the star gravity but the bodies also interact with each other and the large body has enough gravity to keep the smaller body in orbit, like a moon)

    ill keep trying but any help would be appreciated!

  • Thanks RamPack and Guizmus! i actually had to use bits of both to make it work like i wanted to =)

    Guizmus function was really clever but made it so MinusHealthSprite spawned at the end of every timer, regardless of how much health was lost as long as some was lost.

    the solution to that problem was provided in rampacks capx

  • great thanks! =) will check out your capx and see what i can learn!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • holy crap THANKS! that sounds amazing, checking it out!

  • hello good folks i would appreciate some help with a mechanic im struggling with in my project!

    in my project there are sprites called "people".

    people have the number variable "health".

    when "people" overlap a certain other type of sprite, the "health" decreases by 0.X every 0.X seconds.

    and when people dont overlap that sprite, the health increases by 0.X every 0.X seconds.

    that part is easy enough, but it would be nice if there was a better way since "every X seconds" applying to potentially hundereds of "people" is probably not the way to do it...

    the problem:

    everytime a "people" sprite loses or gains health at an integer (example: 50.1->50.0 or 50.1->51) i want to spawn a popup on that "people" informing the player that that particular guy lost or gained 1 health.

    how do i:

    create an event that on "people" variable changed from X to an Integer (higher or lower than X, X can be an integer itself) spawns a popup sprite?

    PS. i might be using the word "integer" incorrectly, but i hope i make sense anyway =)

  • hm ok thanks will try cleaning it up. also, i want to store hundereds of last and first names, is an Array really optimal for that?

  • <img src="https://dl.dropboxusercontent.com/u/65114700/randomnames.PNG" border="0">

    original image

    would something like that work?

  • thanks i will look at the example and read up on arrays!

  • Hello!

    in my project at the start of each level i spawn sprites called "Citizen" with the text variables "FirstName" and "LastName".

    i was wondering how to get and randomly assign a "FirstName" and "LastName" from a list of names i have compiled.

    Searching the forums and tutorials it seems this would be best accomplished with XML files but i dont understand exactly how and maybe there is a better way?

    help please!

  • Link to .capx file (required! If link is blocked remove the http and www parts):

    dl.dropboxusercontent.com/u/65114700/buttonbug.rar

    Steps to reproduce:

    1. create a button

    2. make it invisible but enabled

    3. make an on click button event that plays a sound

    Observed result:

    no sound play when you mouse click or tap with touch on the invisible button.

    it is possible to use other events to play sound when clicking/tapping the invisible button (on touched object play sound) but that will always play the sound even if the button is disabled.

    Expected result:

    sounds should play when you click on the location of an enabled button even if its invisible. (worked in previous versions of construct2)

    Browsers affected:

    Chrome: yes

    Firefox: ??

    Internet Explorer: yes

    Operating system & service pack:

    windows 8.1

    Construct 2 version:

    r159