AlexSV's Forum Posts

  • It kind of blows my mind that you could remember not only the person involved in the topic from four years ago but the exact topic in question.

    Whenever I ask for help, I try to dig into the examples so I can understand how the end result was reached instead of just copying the code. I struggled with math in school, so I have some questions.

    So, when the game starts, we start at the left side at x = 1 since the loop index starts there (or at 0, we start on the left side, is what it is). We use... uuh some graphing equation (math that I didn't do well on) to create a sine wave that doesn't go below a certian y value. This gives us our "surface" pixel. Then our width is 1 since we are building 1 line at a time from the left, and we do the entire height possible of the screen downwards. If we went down below the earth, we'd see the exact sine wave as the top of the earth on the bottom side 640 pixels down, right?

    I'm a bit behind on the erasing code... I can tell both radius and dx are important here. In this instance, we use radius to set DX in order to get the erase code... so each shot that my students program would edit radius to determine the digging power of the shot.

    So... we take both a negative value of whatever the radius is and a positive value of the radius to build essentially a "diameter" of how big the hole is going to be with a range of values. So with -50 and 50, we have 100 loops of this code. Every time we repeat the code, we shave off a ring of the attacked area from... the outside in? I'm basically guessing. This is why I went to summer school for math, haha.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello there! I teach Construct 3 to 4th-6th graders as an elective at my school. Recently, one of my students has been trying to make a little tank game where two tanks roll around and shoot explosive shells at each other. He wants the terrain to be destroyed in circular chunks, like explosions from the Worms series. I must admit, he is stretching the limits of my understanding of Construct 3, and I want to learn more about how C3 works in order to help him.

    I have dug around on the forums, but I keep finding older topics with broken links and conversations that I can only partially pull context from since all the images are gone.

    From what I can gather and what I have (poorly) attempted, I am using a tilemap with 2x2 tiles to represent my earth, and explosions create a sprite object with a circular-shaped collision box. At this point, I need to load all of the tiles that are overlapping the circle into an array and then delete them, correct? I am a bit fresh on arrays, I have only used them to contain level data for spawning a certain number of enemies on certain levels of a game, that kind of deal.

    So I suppose I am asking, how do I properly detect the overlapped tiles, and how do I load them into an array correctly so that I can use the array to destroy them? Or, am I going about this in a difficult way?

  • Thank you so much for this information! I feel like I have gained a lot of useful tools for my toolbox!

  • I see. Since mine doesn't have solid walls I suppose it's good that I have it!

    One last question. I am not familiar with local variables. Why not just use global variables? Unless the variables aren't needed outside of that particular sub event. Do local variables only exist within that sub event and basically cease to exist outside of that particular event?

  • Is this what you are trying to make?

    https://howtoconstructdemos.com/auto-zoom-and-scroll-the-screen-to-fit-multiple-characters/

    This is literally exactly correct. I sort of understanding how this is working, but I was wondering if I could ask some clarifying questions. I don't fully understand it, and while I could just copy it and walk away, I'd like to understand it more fully so that I can do it myself in the future.

    It says for "min" and "max" expressions that it is calculating the minimum and maximum of things, so I assume that if I put in, say, max(3,5,Player.x), then, unless my player x was bigger than 5, it would always return 5, right?

    So what those four expressions in the "for each" do is, for every player that is on the screen, calculates the farthest point of the relevant bounding box for that object, then compares it to the previously calculated value from the previous cycle (which is why max is set to 99999, where no object would reasonably be). I see it's using a "min(max" or "max(min" at the very start of each expression, but I'm not quite sure why that part is done...

    After all that is done, it finds the center of the box by adding the values together and dividing it by 2, and lerps via delta time x 16 (this number could be adjusted however I want, I'd assume).

    It calculates a value to scale the layout to by dividing the difference of the min and max values by the original size of the viewport, then clamps it so it can't go beneath 1.

    I'm a little shaky on the math for the viewport calculation (because I am bad at math) but I think I understand the concept.

  • Hey there, everyone.

    I'm struggling with the concept of moving a camera around. I have this piece of code so far...

    The concept for the non-disabled code is that I have a sprite with the "scroll-to" behavior on it that constantly sets itself between the Player and the Goal. That code is working fine, but when the two get too far apart, the objects both disappear off of the screen.

    The disabled code represents my attempts so far to figure out how to properly scale the layout so that both objects are always visible on screen via scaling of the layout. I do realize that I basically am looking for a number between roughly 0.4 and 1 (depending on the distance between the objects) and that I also need to stop the camera from zooming in when I reach a scale of 1. But in order to do that, I first need to find the formula that would let my camera zoom in and out. The problem with my current setup is that it actually zooms out when the two objects approach, rather than zooming in, and I seem to be hitting some kind of brain fart that isn't letting me proceed. Maybe I've looked at this code for too long, haha.

  • Hey there, everyone.

    I'm using Construct 3 to teach my 6th-grade children simple computer logic and to make games for a small arcade cabinet in our classroom. Today is the second group of kids I'm teaching, and one student, in particular, can't use Construct at all. Every time he loads up Construct in his browser, it turns red, crashes, and gives an error. Every other student is fine, this is only one particular student. His account activation went perfectly well, and he also tried to restart his computer, which didn't help.

    Here is the error.

    Error report information

    Type: unhandled rejection

    Reason: Error: The source image could not be decoded.

    Construct 3 version: r164.3

    URL: editor.construct.net

    Date: Tue Oct 01 2019 13:09:28 GMT-0700 (Pacific Daylight Time)

    Uptime: 2 s

    Platform information

    Browser: Chrome

    Browser version: 77.0.3865.90

    Browser engine: Chromium

    Browser architecture: (unknown)

    Context: browser

    Operating system: Mac OS X

    Operating system version: 10.13_6

    Operating system architecture: (unknown)

    Device type: desktop

    Device pixel ratio: 1

    Logical CPU cores: 4

    Approx. device memory: 8 GB

    User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36

    C3 release: r164.3 (stable)

    Language setting: en-US

    WebGL information

    Version string: WebGL 2.0 (OpenGL ES 3.0 Chromium)

    Numeric version: 2

    Supports NPOT textures: yes

    Supports GPU profiling: yes

    Supports highp precision: yes

    Vendor: Intel Inc.

    Renderer: Intel(R) HD Graphics 6000

    Major performance caveat: no

    Maximum texture size: 16384

    Point size range: 1 to 255.875

    Extensions: EXT_color_buffer_float, EXT_disjoint_timer_query_webgl2, EXT_float_blend, EXT_texture_filter_anisotropic, OES_texture_float_linear, WEBGL_compressed_texture_s3tc, WEBGL_compressed_texture_s3tc_srgb, WEBGL_debug_renderer_info, WEBGL_debug_shaders, WEBGL_lose_context