JJList's Recent Forum Activity

  • newt Thanks! :D I will definitely look into Canvas plugin:) Haven't tried it yet <img src="smileys/smiley9.gif" border="0" align="middle" />

    Personally I would just fill a layer with tiles, and erase those not needed by using the mouse, and layer scale.

    Yeah that'd be easy for simple shapes.. But if we want some complex scenery?:)

    Anyways, thanks for help again:D

    I'm now working on a tilemap editor, and I'll try both methods to compare them:)

    (Tho using Canvas object is a brillinat idea, question about pixelalpha(x,y) as a regular expresson is still up :P)

    Hopefully I'll get it running in a couple of hours ^_^

  • Hmm, that's odd.. It was meant to work for non-sqaure sprites..

    Make sure your initwidth != initheight

    Well, I'm probably wrong:P Mind posting your capx?:)

  • newt Indeed, I've been thinking of a separate editor for the last hour or so:) Maybe even like a simple raster editor.. MSPaint via tilemaps, huh?:)

    But I would still like to know, if the method I've described is possible ^_^

    Ofcourse, this way of generation will take a while.

    And I don't really mind it:) I mean, we'll need to do it just once per generated level, inside a level editor.. Then we save tilemap to a file and simply use that file in our game. So, in this case, does it really matter how long it takes to generate?

    Well, not speaking about 4096x4096 sprites xD

    Let's say, we have a level built of 100 MaskSprites, 64x32 each.

    To generate this one, we'll need to run 100 loops, 2048 iterations each.. That doesn't really sound like eternity to me;))

  • 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.

JJList's avatar

JJList

Member since 2 Dec, 2012

None one is following JJList yet!

Trophy Case

  • 11-Year Club
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Email Verified

Progress

13/44
How to earn trophies