Terraria Clone

0 favourites
  • Got bored and decided to give this a try for fun. So far it is coming out alright. I have yet to figure out how to get explored areas to stay lit. Also yet to figure out how to create a better terrain and a better lighting system with light spill. Anyways give it a go and let me know what ya think. The inventory is pretty shit, it will show up empty and then show gold in it if you get some, but that's about the extent of it. The underground is a procedural array and is different every time you play.

    INSTRUCTIONS

    ----------------------------

    Equip a tool and start digging! See how much gold you can collect.

    CONTROLS

    -----------------------------------

    A & D To move Left & right

    Spacebar to Jump

    Left Mouse Click & Hold to Swing Hammer

    TAB Open inventory

    https://dl.dropboxusercontent.com/u/729 ... index.html

  • Very nice start! I love procedural generation, so many possibilities. I find the dude can't jump up if there's a block above him, is that intentional? Makes it hard to get out of the tunnels. Great stuff though, look forward to seeing what's next!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So I've made some updates to the game There is now a flat grass land on top that will always be generated. The underground is still completely new every play randomly generated every load. I added in the swinging action seen in Terraria and gave the rocks and gold different health. IE Rocks destroy faster than Gold does. I also changed the control scheme to match Terraria a bit closer. Now you just hover your mouse over the brick you want to destroy click and hold. There is a hitbox distance so you can only hit rocks within a certain range. I removed the inventory as it was crap and really didn't work. Next I will be tackling either A: Revealing areas that were dark and having them stay lit as you explore. B: A proper Inventory system with different weapons that and hammers.

    A&D To move Left & Right

    Spacebar to Jump

    Left Mouse Click to Swing Hammer

    Note: For some reason in Firefox and IE the map shows up like a weird grid thing, grid lines going through everything. No clue why as this doesn't happen in testing within Construct. Chrome however shows the game properly.

  • Tile seams show up if Point sampling, Pixel rounding and Letterbox integer scale aren't on. Problem is turning these settings on makes everything look a bit grainy and pixelly, but that might suit the look of this game! More info on Tilemap (you are using Tilemap right?): https://www.scirra.com/manual/172/tilemap

  • Interesting!

  • lolpaca, no not using Tilemaps just straight sprites. I haven't used Tilemaps before but that seems like it may be the way to go. Well all the Terrain is a single sprite object with a different sprite on each animation frame. So I have one object called terrain, frame 1 is dirt frame 2 is rock frame 3 is gold frame 4 is grass and so on.

  • Another quick update, the dirt layer is now destructible so you can dig through dirt grass rock and gold now. All with varying health. The inventory is back it sort of works in that it can be opened and closed with TAB and it will show if you have gold and how much gold you have. There is a new graphically bug where a black line runs across the top of the screen. The grid line issue has been fixed somewhat, how it was fixed I have no clue. There is also some FPS lag when opening and closing the inventory whenever you obtain gold.

  • Another small update. The inventory lag issue should be fixed now. The ground sprites now have a bit of rough edging so it's not just perfect squares. Got rid of the graphical bugs as well, IE weird black line across the top and odd gridlines. Right now I'm trying to figure out a lighting system. Where if you start digging down light will spill from outside to the underground and light it up a bit. I thought maybe a particle system would work for this but particle systems don't have collision so that is a no go for right now. If anyone knows of some advanced lighting techniques let me know.

  • For the lighting, you could try something similar to what's in my game, there's a brief description of how I did it on this thread PM me if you want more details

  • Small update you now start off without the hammer equipped and you will have to select the Hammer from the inventory to use it. Also there is a hammer icon around the cursor to easily identify what item you have equipped at the time.

    lolpaca I'll have to look into that, I read over it quickly and it seems a bit over my head. I think I will be able to figure it out sooner or later though lol. Thanks for the help.

  • Very nice. Are you updated to tilemap in the last update? I try it using Firefox and the game is fine.

  • No still using a single sprite object for all of the terrain. Been working on some other stuff such as the inventory so I haven't had a chance to learn tile maps just yet.

  • Can you explain a little more how you create a the terrain? I'm novice with that. With an array maybe?

  • Is the terrain infinite?

  • How I created the Terrain. I followed a really great tutorial, Procedural Generation for Beginners Tutorial by abhilash2863. Full credit goes to him for an awesome PDF he put together on procedural generation.

    Create an Array.

    Assign each X & Y element a random integer from 1-20.

    Assign each X element in the Y element 0 to integer 21.

    If an elements number is less than 13 create object Terrain and set animation to dirt.

    If an elements number is 14-18 create object Terrain and set animation to rock.

    If an elements number is 19-20 create object Terrain and set animation to gold.

    If an elements number is 21 create object Terrain and set animation to grass.

    All of this runs on Start of Layout so every time the level is loaded this runs and assigns new random numbers excluding the top of the Terrain which is always set to 21 which will be grass. The underground however is always randomly generated so it will never be the same.

    So with a single sprite object, Terrain, I was able to assign it multiple animations. Animation Rock, Grass, Dirt, Gold, and each animation is a single frame of Grass, Rock, Dirt, or Gold. I was then able to assign instance variables to the Terrain object. GoldHealth, DirtHealth,GrassHealth, and RockHealth. When you hit something the events check to see which animation is currently playing if it is currently playing rock animation and you hit it then subtract 1 from rock health. If Rockhealth is equal to 0 then destroy Terrain object. So on for the rest excluding gold in that is GoldHealth = 0 then destroy Terrain object and add 1 to a Global Variable called Gold. Which is a counter that keeps track of how much gold you currently have.

    So that's pretty much the main bulk of the Terrain code.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)