User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13

Thread: Need help with random tiles

  1. #1
    Clicker Fusion 2.5HTML5 Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)

    Join Date
    Aug 2015
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Need help with random tiles

    I'm trying to make an endless runner

    I want to have randomly generated tiles so that the game is fresh with each run.

    But I have no idea how to do this.

    How do you make randomly generated tiles?

    (I'm currently using the free version of Clickteam Fusion)

    here's what my game looks like so far:
    Attached files Attached files

  2. #2
    Clicker Fusion 2.5
    Bertard's Avatar
    Join Date
    Jan 2014
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Start of frame => start fast loop "Tiles" 25 times

    When "Tiles" is playing
    +Pick one tiles at random => Destroy tiles

  3. #3
    Clicker Fusion 2.5
    Bertard's Avatar
    Join Date
    Jan 2014
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tiles random.mfa

    There is an exemple

  4. #4
    Clicker Fusion 2.5 DeveloperiOS Export Module
    ChrisBurrows's Avatar
    Join Date
    May 2011
    Location
    Tasmania, Australia
    Posts
    622
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Gahsp. Only a fool discerns a post by its title.

    There are a gajillion and 1 ways to achieve your goal. Here's one.

    It store's the "tiles" in a single active and generates the map and startup, by randomly selecting an animation frame, pasting it into the backgroud, and repositioning the active at the right edge of itself ready to paste the next. You'll notice it can pick the same frame twice in a row which looks ugly, you'll need to add a check to prevent this. If this method digusts you, tell me it does and I'll come back at you with something else.
    Attached files Attached files

  5. #5
    Clicker Fusion 2.5HTML5 Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)

    Join Date
    Aug 2015
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry for the late response guys

    First of all thank you Bertard and Thank you ChrisBurrows for taking the time to help me. I appreciate it!

    To Bertard: looks cool, but not exactly what I was looking for, but thank you =]

    To ChrisBurrows: cool Ill take a look at it, that sounds interesting, I'm definitely gonna try it out and let you know =]

  6. #6
    Clicker Fusion 2.5HTML5 Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)

    Join Date
    Aug 2015
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ChrisBurrows View Post
    Gahsp. Only a fool discerns a post by its title.

    There are a gajillion and 1 ways to achieve your goal. Here's one.

    It store's the "tiles" in a single active and generates the map and startup, by randomly selecting an animation frame, pasting it into the backgroud, and repositioning the active at the right edge of itself ready to paste the next. You'll notice it can pick the same frame twice in a row which looks ugly, you'll need to add a check to prevent this. If this method digusts you, tell me it does and I'll come back at you with something else.
    I checked it out just now and it's what I was looking for. Thank you so much!!!

    One question though. Would I have to create a series of premade platform for this to work?

    What if I was using single tiles?

    I'd be very insterested to see other methods that you may have if you don't mind =]

  7. #7
    Clicker Fusion 2.5 DeveloperiOS Export Module
    ChrisBurrows's Avatar
    Join Date
    May 2011
    Location
    Tasmania, Australia
    Posts
    622
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    This is a little more complicated, I'll run you through it.



    "Areas" are stored in external text files. For each "Tile" within an area, 3 lines of text are required, one for it's name, and two for it's x,y position relative to the beginning of the area. At the end of the file, the command "#WIDTH" indicates the next line will define the width of the entire area, deciding at what x position to create the following area.

    All the possible area names are stored internally in a list object called "Area Pool". The loop "MapGen" randomly selects one of the two first areas in the pool, creates it, and then moves that area name to the end of the pool. This prevents the same area being created twice in a row, while still producing areas at random.
    Attached files Attached files

  8. #8
    Clicker Fusion 2.5HTML5 Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)

    Join Date
    Aug 2015
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks so much for the description

    I took a look at it and what I'm getting from this so far is that each text file represents an "area" or a building, it's name, each piece of the building in that area, and it's coordinates.

    and the #WIDTH is the width of the entire "area".

    However I notice that the width in #WIDTH is larger than the actual width of an area. Is the extra width what creates the gaps in between each area?

    Also

    I was looking at the code and I noticed something called "blit". What is "blit"?
    -----------------

    just a couple more questions.

    In
    line 6
    can you explain to me a bit about what is going on with that line? I just want to make sure I'm understanding all this.


    finally,
    I tried switching "start of frame" in Line 5 for the mapgen to "always" but it runs very slow and lags. How do you make it infinitely loop?

  9. #9
    Clicker Fusion 2.5 DeveloperiOS Export Module
    ChrisBurrows's Avatar
    Join Date
    May 2011
    Location
    Tasmania, Australia
    Posts
    622
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Sure. First up, if you're unaware, Fusion reads events from top to bottom, and executes actions within each event, from top to bottom.
    Double click any action to view it a list of actions for that event. I changed the icon of the Area Pool list object to red for readability.



    : Set RandomNumber to Random(2)
    Random(x) is function which generates a random number between 0 and x-1. So this assigns a global variable called RandomNumber to 0 or 1.

    : Set AreaName to List Line Text$(""), Random Number)
    Retrieves the line from the Area Pool list object corresponding to the value of RandomNumber, and stores in a global string called AreaName. It's worth noting I changed the base index (the first line) to have an index of 0 rather than 1, the reason being Fast Loops have a base index of 0 and it makes comparisons easier. You change it in the List Object properties.

    : Delete line RandomNumber
    Deletes the line corresponding to the value of RandomNumber

    : Add Line AreaName
    Reinserts the deleted line, whose contents was stored in AreaName, back into the list object, at the end.

    : Create at (0,0)
    A weird bug I discovered while making this example is that if you load multiple external files into a List object within a single fast loop, only the first file is loaded!!! Until after the loop, when Fusion loads the most recent file you asked for. So, if you create and destroy a new List Object each time you need to load data into it, it solves the problem.

    : Load list file Apppath$ + "\Data\" + AreaName + ".txt"
    Loads the external file AreaName.txt into the newly created List Object, this is the Area Contents list.

    : Start Loop "Blit" List NB Lines ("") times
    Starts a nested fast loop called "Blit", and runs it as many times as there are lines in the Area Contents list. Blit simply means to draw to the screen from a source, which is exactly what the Blit loop does, creates and pastes Active objects all about the place.

    : Destroy
    Clean up. Destroys the current Area Contents list, ready to create the next one. It is very important to understand that this action isn't executed until the entire Blit loop (started above) has been executed.

    So, that's it. This entire list of actions is contained within a single fast loop called MapGen, which is run 20 times at Start of Frame to create the map. If you change it to always, then on every single frame (60 times per second) you are creating 20 more Areas, a total of 1200 areas each second, and that's explains the framedrop. You may as well create the entire level at start up. And correct, the extra width is to accommodate for the gaps between areas.

    If none of that made any sense, you should read this article on fast loops. Good luck man.

  10. #10
    Clicker Fusion 2.5HTML5 Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)

    Join Date
    Aug 2015
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah I see, I think I'm starting to understand it

    Thank you so much again for having taken the time to help me I really do appreciate it

    Good luck to you too =]

Page 1 of 2 1 2 LastLast

Similar Threads

  1. How to do tiles?
    By gdog105 in forum Fusion 2.5
    Replies: 6
    Last Post: 5th July 2015, 10:49 PM
  2. How to generate a random topdown RPG level (with tiles)
    By Morbus Crohn in forum Multimedia Fusion 2 - Technical Support
    Replies: 17
    Last Post: 28th July 2012, 08:48 PM
  3. Tiles?
    By Atom in forum File Archive
    Replies: 5
    Last Post: 22nd April 2009, 05:49 PM
  4. Moving tiles
    By GWGord in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 9th September 2008, 05:39 PM
  5. Smart Tiles
    By Novabrain in forum Extension Developers Lobby
    Replies: 6
    Last Post: 25th September 2007, 05:43 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •