JJList's Forum Posts

  • Anytime! <img src="smileys/smiley2.gif" border="0" align="middle" />

    Glad I could help ^_^

  • newt I still think that filling entire tilemap by hand inside layout editor.. with 1px tiles.. is a real pain in the butt, pardon my french.

    At least until we get an adjustable "tile brush" or something like that.

    I guess, generating tilemap (as a collision mask, just one tile) and using sprites as a reference is a way to go. Probably I'm wrong:(

    And i really have no idea how to implement generation of non-rectangular shapes, due to the limitaions of C2 and tilemap system.

    everyone and especially R0J0hound :P

    =

    ( Caution! Abusive logic detected. Author is not responsible for any brain damage caused by reading the following text )

    =

    But! Imagine that we have a method to detect alphachannel value of a particular pixel in a raster image?

    Something like pixelalpha(x,y)=[0..255]. Where (x,y) is the position of the pixel inside an image.

    (I believe it's not too hard to implement it as plugin or something..

    No idea how it works, tho :P)

    Then we could set up our layout with sprite scenery( lets call it MaskSprites ), like I did in the example..

    NOTE that MaskSprites should have origin at top-left.

    On start of layout we just need to populate a huge array.

    Here it gets tricky and will definitely take a while to do..

    So, for each MaskSprite we run a loop like

    |   for i from 0 to MaskSprite.width

    |     {

    |        for j from 0 to MaskSprite.height

    |          {

    |             if pixelalpha(i,j)=255 set Tilemap At(MaskSprite.X + i, MaskSprite.Y + j)

    |          }

    |     }

    So we'll get our collisionmask tilemap generated, following the shape of all MaskSprites we have.. And we have our layout scenery underneath. Then give our tilemap something like Addictive blendmode or Overlay fx and TADAM! We have our level :D

    Does that make any sense, guys?:P

    UPD: I do understand that generating entire level each time we start our layout ingame is insane xD

    But we can use it in level editor or something, then save our tilemap as JSON( or however we save tilemaps ) and just load it from that file?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I guess here's a way..

    Give your sprite 2 variables- initwidth and initheight to store the size you want it to scale up to.

    Then make something like

    On conditions met ->

    -sprite.width < sprite.initwidth -> add 1 to sprite.width

    -same for sprite.height

    There should be a better way, but this is first that comes to my head:P

    Hope it helps:)

  • newt wow, 40-45 fps? And that's while rendering a ton of 1x1 pix tiles.. Ain't that impressive? :D

    Sure it still has those little "chokes" when erasing tiles, even on desktop:(

    Note sure if we can avoid it.. but I think it's not that bad and it fits worms-like games pretty good:)

    Another problem I see is to "draw" the tiles. Kinda hard to fill our layout with 1pix tiles manually:(

    Any thoughts on how to solve this one?

    One way, i guess is to use tilemap as a collision mask, leave it empty,

    build our level scenery with regular sprites/tiledBGR and than generate our tilemap on those sprites.

    Here's an example. Mask generation

    Works fine for rectangles.. Not sure how to do it for other shapes:(

    Ideas?:)

  • That should be similar to how I did unlocking skills.

    Give each skill sprite a new variable "level".

    Events possible:

    -If skillsprite is selected & aqquired(or unlocked) & .level <=2

       then make UpgadeSkilButton(or whatever) visible

    else make it invis

    -UpgradeButton is clicked & selected skill.level <=2

       then add 1 to selectedskill.level

    Something like that might work)

  • Now that's what I call an optimisation! <img src="smileys/smiley32.gif" border="0" align="middle" />

    Thank you so much R0J0hound ! I understand the changes you've made, and I totally agree. I've learned alot from them, thanks again <img src="smileys/smiley9.gif" border="0" align="middle" />

    Hehe, I guess that's a nice way to generate new ideas: first, a curious newbie (Me) shows a potential of something to an experienced person(Master R0J0).

    Than this skilled person finds the best way to make it work and releases a nice new solution, usable for all other community people:P

    R0J0hound, I admire your skills:) Would be nice to see if avoiding sqrt() can make it run even faster! (Tho I think it's already usable as it is :P )

    P.S. Would be nice if someone could test it on mobile platforms, btw ;)

  • Hmm, do you need an instant generation? Take a look :)

    Tho it's not as good as it might be :( Size of the generated map is pretty random, also you'll need to sacrifice your "maxturns/turns" system.

  • Yay, think I'm getting closer :D Example 2

    Now it's clean, but still seems a bit slow :( Any ideas how to make it run smoother?:P

    //Upd. Not sure if it is any faster, but Example 3

    Allright, I'm running out of ideas <img src="smileys/smiley36.gif" border="0" align="middle">

    //Upd. Looks simple, but still slow : Example 4 and Example 5

  • Hey guys!

    Just curious if someone's tried to do it without using 3rd party pug-ins..

    Here's what I've tried to do:

    Example capx

    Bresenham's algorithm inside a while loop & decreasing radius. Yikes <img src="smileys/smiley11.gif" border="0" align="middle">

    Well, it works, but waay too buggy and dirty, as expected:)

    Try setting global Radius to 32 and radius decrement(at the end of first "while" loop)

    to something like 0.05 and you'll see that it's way too CPU-abusive..

    Yeah, I know it's far from optimal:(

    I would really appreciate if someone point me in a right direction on how to optimise this algorithm <img src="smileys/smiley9.gif" border="0" align="middle">

    Or, even better, show me a better filled-circle drawing method :P

    Not that I need it badly for my projects, just curious <img src="smileys/smiley36.gif" border="0" align="middle">

    //upd I guess I have an idea how to modify Bres's algorithm, but I'm too weak at programming so it may take a while <img src="smileys/smiley9.gif" border="0" align="middle">

    Thanks in advance!

    George.

  • Anytime, mate:)

    Btw, I've been playing around with your capx recently and tried to add 3 more floormarkers.. Got a noticable FPS dropdown : way too many individual sprites.

    Using TileMaps is waaay more efficient FPS/CPU-wise.

    Take a look at this example!

    Actually, it's first time I've tried tilemaps, and I see a HUGE perfomance boost:P

    Yet another little "magic trick", thought it might be helpful;)

    (P.S. Omg, THIS is hot :D)

  • You're welcome:)

    Oh, right, forgot to mention!

    C2 seems to have a weird "overlap" detection.. objects count as "overlapping" even if they are just "back to back"..

    hmmm, not sure how to explain it:(

    Just look at the floormarker's collision box, you'll see that "magic trick" is to make it a bit smaller than sprite itself :)

    Hope that helps!

  • Hello!

    you need an event like:

    "On button clicked" do "System -> Restart layout"

  • I think you need to check if your floormarker is overlapping floortile every turn, before spawning a new floortile.

    Something like This, I guess.

    This is just one way to prevent spawning several tiles at same location.

    Also, preventing your floormarker from going on a location that is not empty (already has a floortile there) might be another way to solve your issue. All you need is to check if location is empty before moving floormarker there.

  • I know, mate. As I've said, it is not a complete solution,

    but a working system that (I hope) can be easily recreated/modified to meet PSI's needs:)

    And the reason why it was not working on your smartphone is no touch input added, I believe :P

  • I haven't tried mobile platforms yet, so not sure..

    But making a polished PC project and then porting to other platforms seems like a nice idea to me:)