Sam Dimanche's Recent Forum Activity

  • I think the problem is the "Destroy" command only has an effect at the end of the frame (it's due to how C2 works, it's not the fault of your code). A destroyed item can still be picked in the same frame it's been destroyed.

    Try creating a Boolean for your Spr_test called "Destroyed". Then, change your code a bit :

    For "MakeItems" = 1 to 3

    Pick an instance of spr_test at random with "Destroyed = True" (just add this condition under the "pick at random" part)

    --> set spr_test.var to a random number between 1 and 3

    if spr_test.var = 1 --> create newSprite1 at location of spr_test --> set spr_test.Destroyed to True and delete spr_test

    if spr_test.var = 2 --> create newSprite2 at location of spr_test --> set spr_test.Destroyed to True and delete spr_test

    if spr_test.var = 3 --> create newSprite3 at location of spr_test --> set spr_test.Destroyed to True and delete spr_test

    Edit : well I was too slow to answer ^^

    You could indeed use the spr_test.var as a sort of boolean if it's starts at 0, yup.

  • Well, now I must recognize it is the best version for sure. It'll probably help a lot of people, congrats

    ++

  • dop2000

    Hum, interesting. Extremely Simple indeed.

    (I just don't understand why the Red Dot is always considered "overlapping" one Block, when he clearly is only touching with the side which I thought shouldn't be considered "Overlapping").

    I still like our previous method. You got stuck because the gap was too narrow, and it can be solved by augmenting the number of nav points I suppose :3

    But yeah, we're going a little too far maybe. There are plenty of ways to deal with this problem and every project will have different needs.

    alextro : I can see the resemblance

    Cheers, see you around !

  • dop2000 I tend to do that, yes ^^'

    Well observed, important corners were indeed overlapping either 0 or 2 other points. I hadn't noticed that and it led you to this version !

    I've toyed with the demo and it works fine now except I detected a problem if the sprite moves in a U shaped zone. Sometimes it will take an unauthorized shortcun, cutting through the air. That's why I added instances variables in each Points, storing the authorized moves from there so that the Sprite can check them when it's looking for a new target.

    Again, maybe it's not optimized but it works.

    Well, I think we're close to having our final build here. I hope it will be useful to someone (OP ?). I know I'll maybe use it some day myself

    The link here (I'll try to keep it store for a long time for those interested) for the last version :

    mediafire.com/file/lu1fk1dwnzyt3de/ExerciseStickingMob_dop2000_semorehV2.capx

    Cheers !

  • Yeah alextro the line is definitely the best way to do it if the position of the tiles remains the same, but the challenge here was to create a path that can adapt if the Blocks are randomly positioned =)

    Really cool, straightforward Demo though !

    dop2000 : thanks for the improvements !

    • I like your way of creating every points and THEN deleting those we don't need. It's much more straightforward than my previous method.
    • Your idea of using Families instead of "Zones" to refer to two different points in a condition is neat.
    • You got rid of 8-dir behavior and now the movement of the sprite is continuous
    • Overall, great optimization !
    • I can't find any MoveTo behavior. Is it a plugin ?

    I tried to improve over your version one last time. The changes :

    • I've modified blocks' Imagepoints so that the sprite is really "sticking" to them and there's no margin.
    • It created new problematics namely in concave corners, where several points were slightly overlapping. Now they're considered "clones", and if one was the LastPoint, then neither it nor the clone is considered a potential target.
    • I've reworked the movement a bit so that the sprite never moves diagonally

    Here is the new Capx : mediafire.com/file/gkk4jd9n7bdmf4e/ExerciseStickingMob_dop2000_semoreh.capx

    Science, yay !

  • Hello Fakov !

    I'm not saying it is the perfect solution, I'm not a "pro" but here is a solution I've come up with :

    mediafire.com/file/7xbcx7rb9uk1f9t/ExerciseStickingMob.capx

    Everything is explained into the Capx, but to sum up, my method is :

    1/ Creating Nav Points around blocks, which the Mob will be able to follow.

    2/ When the mob reaches a Point, he decides where to go next by selecting another close point as long as he doesn't go backwards

    I hope it helps. I was unsure I'd be able to do it so I took it as a challenge ^^

    If someone has remarks regarding that Capx, I'm interested (for science !)

    ++

  • It's indeed written in the manual and it explains everything, my bad. Thanks a lot for your help ! =)

    Case closed.

  • Hi NN81 thanks for your answer.

    I exported without touching anything, so all three options (Window Frame, Rezisable Window, Kiosk Mode) were indeed enabled.

    I've tried to disable Kiosk Mode, and now the game doesn't open in FullScreen anymore but in Windowed. The FullScreen toggle then works just fine and there is no more crash. So this solves the problem ! Nice !

    Thanks a bunch !

    One last thing : can you explain what the Kiosk Mode is supposed to do ? Am I losing something by not enabling it in my project ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey guys !

    I've bumped into a major and consistent crash problem after compiling my project. It is related to a new functionality that was supposed to enable/disable FullScreen in the Parameters Menu of my game.

    For information, I'm previewing my project using NW.js in C2, and it works like a charm.

    However the preview doesn't seem to be helping at all, because when the project is indeed exported... it doesn't work.

    • the game opens in FullScreen mode (but somehow he doesn't "realize" he's in full screen, cf the DebugBox in the files I'll link to)
    • if I ask him to go Window Mode (by using the Cancel FullScreen action of the Browser object) the game instantly crashes and I have to go CTRL+ALT+SUP to close nwjs.

    I don't know how to solve this. I've tried to :

    • cancel FullScreen as soon as the game loads, but it doesn't work
    • play with the Window Size using the Nw.js object, but it doesn't work.

    You can download both the preview mode and the Exported version of the simplified project here :

    The full export project (linux, osx, windows) : mediafire.com/file/jjs3u2w8ack3t7q/FullScreenTest.rar[/li]

    Thanks in advance for those who'll take the time to help me !

  • dop2000

    Oh ! I love your system, the use of the For Loop and the Dictionary, much more compact !

    There's a slight difference with my previous system : when a button is pressed, I start "holding" on the same frame it is pressed, when you only start "holding" one frame later since you can't have PRESSED and HOLD at the same time in the Dictionary.

    That said, I'll probably adapt your system a bit and use it, it is much less tedious to write so I can more easily add more buttons

    Also, I love these kinds of expressions :

    [quote:12h3srhn]Set Keyname to loopindex=0 ? "A" : loopindex=1 ? "B" : loopindex=2 ? "X" : "Y"

    What's the name of this advanced way of writing ? Is it Java ? If so I need to give it a shot, it's very convenient.

    (isn't it missing a "loopindex = 3 ?" before the "Y" ? Maybe there's a difference because it is the last one)

    Thanks a bunch \o/

  • I was worried about the fact my Keyboard triggers may be broken too and would need to be reworked, but surprisingly they're not. You can input several keys at the same time, and one normal trigger is enough to detect them all. Maybe it's just that the detection range is shorter, so it's harder to "mix" them ?

    (of course at one point my keyboard stops detecting too many simultaneous inputs, but I know it's a mechanical limit)

    Here is a V3 of my capx with this result : mediafire.com/file/i7a4a0c6c72sasg/PbDoubleTriggerPadV3.capx

  • Interesting, but I don't like the "unprecise" aspect of the tick range. I'll stick with my solution so far, but thanks

    It's impressive that we're proposing all these colorful workarounds when it should really be a basic fonctionnality of construct's gamepad object

Sam Dimanche's avatar

Sam Dimanche

Member since 31 Dec, 2016

None one is following Sam Dimanche yet!

Trophy Case

  • 8-Year Club
  • Email Verified

Progress

9/44
How to earn trophies