dop2000's Forum Posts

  • Check this out:

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

    I think I managed to make a nice system that tracks the state of all buttons (Pressed->Hold->Released->Nothing) and doesn't use the "On button pressed/released" events.

  • totoe

    (loopindex=8 ? 1 : loopindex+1) means "if loopindex=8 then 1, otherwise loopindex+1".

    It's a shorter version of "If then else" event.

    I'll explain again how I did this.

    You need to define an image points for every node (red dot) of your sprite's collision polygon.

    Image points should be located as close as possible to red dots, but a little bit outside of the collision polygon, just a couple of pixels.

    See this picture, green dots are my image points:

    Once a collision with the asteroid is detected, I take a small 4x4 pixels sprite called Detector©® and place it at image point 1.

    Then I move it from image point 1 to 2, then from 2 to 3, and so on, and finally from 8 to 1.

    While it's traveling, I constantly test if Detector it's overlapping the asteroid. If overlapping, I spawn particles at Detector location.

    I should add that my example is not optimized. Detector sprite travels long distances 1 pixel at a time, performing overlapping check every step. And at every pixel where it overlaps with the asteroid, it spawns particles. As a result, there could be 100-200 particle objects spawned! All this may cause huge lags on a slow computer or mobile.

    I don't think in a real game you need such precision, so you can move the Detector sprite 2, 4 or maybe even 10 pixels at once. This will significantly reduce the CPU load.

  • Use particles, here is an example. I highlighted the important bits:

  • "On button pressed" is a triggered event. It's triggered only once for every button pressed.

    I think what happens is when you press 2 buttons quickly enough, this event is triggered once for both buttons.

    The problem is, Gamepad.LastButton(0) only stores one of the buttons codes, not both.

    The best you can do is this:

    Here is the output if I press two buttons quickly:

    Pressed

    Button: 4

    Button: 5

    --

    Unfortunately, the same happens if I am holding button 4 and then press button 5.

    So this solution is not very reliable.

    I would recommend not to use "On button pressed" event at all.

    Detect buttons pressed using testing events "Is button down" or "Is button index down". You can add "System->Trigger once" condition if necessary.

  • Invisible buttons (or buttons on invisible layers) can still be clicked.

    You need to add another condition to your "On QuitButton clicked" event - something like "Is Layer PauseLayer visible" or "Is GamePaused".

    Another way to do this is to move all PauseLayer events to a separate group in your event sheet, and disable this group. Enable it only when player presses pause.

    By the way, you should also be aware, that when your PauseLayer is visible and you click a button on it, this click may be registered by your main game events - your character will fire a weapon or something like that. So you need to disable game controls group when you activate PauseLayer.

  • You may also be able to do this without physics.

    Add Bullet behavior to your ball, set Bounce off solids=yes, Set angle=No, Gravity=10, speed=100. (experiment with these values)

    Add Solid behavior to the floor.

    Create an event to increase bullet gravity every time the ball collides with the floor:

    On Ball collision with Floor -> Ball set Bullet gravity to Ball.Bullet.Gravity*2

    This will make the ball to jump lower every time.

    You can control the ball by changing its bullet properties - speed, angle of motion, gravity.

  • You can add another variable OldLevel and do this:

    System->Compare variable-> Level not equal OldLevel
       System-> Create object .....    
       OldLevel=Level
    [/code:1x5uggcn]
  • Oh, so you manually set up the grid in editor and it's not changed during the gameplay?

    I thought your grid is randomly generated.

  • [quote:24ci50dw]If indicator overlaps with a block that's DISABLE = 1, it would get reassigned to block.FALLBACK

    What if that block is also disabled?

  • You can also set its opacity to 1 or even 0.01, and move it almost off the screen, so that just a couple of pixels of it are visible.

  • 1) I'm checking text size once but with 0.05s delay. If you remember, I mentioned earlier that you need to wait till the next tick to allow the system to render the text.

    After that I'm using Repeat 10 times to resize the bubble.

    2) I didn't understand why you had "Wizard & newline", that's why I removed it

    3) Global variable was just a quick and dirty solution.

    But yeah, you should implement something like this instead of calling a different function for every new dialog line.

    What are you going to do with the Source_text object (black text)? You are using it to measure the text, but how are you planning to hide it from the viewer?

  • I don't understand how everything is supposed to work in your project, not sure what some of the objects and variables are for...

    So I had to make quite a lot of changes, sorry. But I think it now works as you described.

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yoo-hoo!!! It works!

    Collision Point Detection Demo

    CAPX

  • Nice example!

    I didn't know you can change position/size of a sprite and then immediately test if it's overlapping another object in the same event. I thought you need to wait for the next tick.

    So using this technique I think you can find the point of collision with fairly complex shapes.

    Will need to define a few image points - one on each node of the collision polygon, where the red dots are.

    ("polygon" made with image points should be slightly larger/ slightly outside of the collision polygon)

    When collision with an asteroid is detected, take a small sprite, say 4x4 pixels, and move it from one image point to another (along the blue lines), constantly checking if it's overlapping the asteroid. Once it's overlapping, that would be your collision point!

  • Trying a different solution right now. I'd love to see your solution in a capx though <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">

    Here you go:

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

    I think it works pretty well.

    EDIT:

    Except for this situation:

    It's impossible to select the two blocks in the middle.

    I think you should have the same problem if you are doing it the way you described in the first comment.

    You need to add diagonal movement - check if DOWN+RIGHT pressed simultaneously, as this would be the first thing players will try to do to reach those blocks in the middle.