Jump to content

Search the Community

Showing results for tags 'csv'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 9 results

  1. I'm relatively new to Python and I'm trying to create a CSV file from data within my program. I've read a bit about the csv module, but I'm not entirely sure about the best approach to create a CSV file and populate it with data. Could someone guide me through the process and provide a code example? Let's say I have a list of dictionaries containing data about products, like so: products = [ {"ProductID": 1, "ProductName": "Widget A", "Price": 10.99}, {"ProductID": 2, "ProductName": "Widget B", "Price": 15.99}, {"ProductID": 3, "ProductName": "Widget C", "Price": 8.49} ] I want to create a CSV file named products.csv with the following headers: "ProductID", "ProductName", and "Price", and then populate it with the data from the products list. I tried looking for a solution by visiting numerous forums and websites like Scaler, but I was unable to do so. Could someone provide me an example of how to accomplish this using the Python csv module? I would be very grateful for any advice!
  2. Hello all! I'm make top down game in Phaser 3.9.0 and have a problem. I'm created map in Tiled ver. 0.18.2. and export it in .CSV. It turned out , 5 files = 5 layers. How all of them combine to a mp? My code. function preload () { this.load.image('tiles', 'assets/map/tileset/tilesheet.png'); this.load.tilemapCSV('map', 'assets/map/csv/world_ground.csv'); this.load.tilemapCSV('map', 'assets/map/csv/world_groundvariations.csv'); this.load.tilemapCSV('map', 'assets/map/csv/world_grass.csv'); //and other... } function create () { //MAP map = this.make.tilemap({key : 'map', tileWidth: 32, tileHeight: 32}); var tileset = map.addTilesetImage('tiles'); ground = map.createStaticLayer(0, tileset, 0, 0); grass = map.createStaticLayer(1,tileset,0,0); } Error: Cannot create tilemap layer, invalid layer ID given: 1 This is what is displayed on the screen. Only First Layer
  3. I am really struggling with collision on CSV tilemaps. I am creating the CSV string in the create function before doing the Phaser tilemap stuff. The map is rendering as expected along with the player sprite but collisions are not happening. The CSV map consists currently of 1s and 0s but I'll add more later. 0 should be impassable. Here is what I've got in the create function. this.game.cache.addTilemap('map', null, csvContent, Phaser.Tilemap.CSV); this.map = this.game.add.tilemap('map', 16, 16); this.map.addTilesetImage('dungeontile'); this.map.setCollision(0); //I don't think this is doing what I think it does. this.layer = this.map.createLayer(0); this.layer.resizeWorld(); In the update function, I have this: this.game.physics.arcade.collide(this.player, this.layer); I think that is the important code. I also have arcade physics enabled for the game and player. Sorry if I'm missing something. Any thoughts on why this isn't working?
  4. Hi everyone, I'm generating a random dungeon that I convert to CSV ( with Array.join ) but I can't find how to make it works with the Game.load.tilemap because the file doesn't need to be download as it's just a string in the program. How can I do to make my CSV string work with the pahser loader ? Thanks !
  5. Since my previous post I have been wondering on how I can map tiles myself within Phaser using the slopes plugin. If I wanted to include tiles such as "hills" or different sorts of slopes, are there any good tutorials out there that explains this? It would be very beneficial to the game I am creating. I am using 32x32 tiles with arcade physics. I've read in this file I downloaded about a "Arcade Slopes converter" which I'm unsure about. I've included the current tile sheet I created and using to test things out as well as the full code. Any help is appreciated! This is my current code for the mapping of my tiles. this.game.slopes.convertTilemapLayer(this.ground,{ 1: 'FULL', 2: 'FULL', 3: 'FULL', 4: 'FULL', 5: 'FULL', 6: 'FULL', 7: 'FULL', 8: 'FULL', 9: 'HALF_TOP', 10: 'FULL', 12: 'FULL', 13: 'HALF_BOTTOM_LEFT', 14: 'HALF_BOTTOM_RIGHT', 15: 'HALF_BOTTOM_LEFT', }); Test Game Phaser.rar
  6. When Phaser parses a CSV file it creates an extra tile with an index of NaN at the end of each row except the last one. I believe this is because of the trailing commas at the end of each row, except the last. I noticed the parser uses .split() to parse each row of tiles so that might explain it. My CSV data is structured like so (also how Tiled Map Editor exports the data): 0,0,0, 0,1,0, 0,0,0 I may just be doing something wrong though. Any ideas?
  7. Hello, I'm using BSP to build an array for level generation. For now, the 2d array contains either a 0 or 1, for empty space or where a tile should be. I'm then trying to use the array as a string to pass into the tilemap function. However, none of the methods I've tried for generating the tilemap are working. The closest I've been able to get is throwing an error in phaser.js's getIndex function, saying that the "location" property is undefined. That seems like this issue, but that's been reported as fixed. I'm using version 2.4.4 of Phaser. I saw another thread that said 0 shouldn't be used, because when Phaser loops through the data, it only looks for things greater than 0. I changed it to use 1 for empty space, and 12 for a tile (just to pick something from my tilesheet), but that made no difference. Someone please tell me what I'm doing wrong! Here is the tilemap I slapped together for testing: Here's the code I'm using (stripping out all of the level generation stuff): var TILE_SIZE = 32;var WIDTH_RATIO = 0.45;var HEIGHT_RATIO = 0.45;var ITERATIONS = 4;var mainRoom = undefined;var levelArr = [];var map;var BSP2 = function (){ this.levelWidth = 0; this.levelHeight = 0; this.tilesPerRow = 0; this.tilesPerColumn = 0; this.roomTree = undefined; this.rooms = [];};BSP2.prototype = { init: function(levelWidth, levelHeight) { this.levelWidth = levelWidth; this.levelHeight = levelHeight; this.tilesPerRow = levelWidth/TILE_SIZE; this.tilesPerColumn = levelHeight/TILE_SIZE; mainRoom = new RoomContainer(0, 0, this.levelWidth, this.levelHeight); levelArr = new Array(this.tilesPerColumn); for(var i = 0; i < this.tilesPerColumn; i++) { levelArr[i] = new Array(this.tilesPerColumn); } for(var c = 0; c < this.tilesPerColumn; c++) { for(var r = 0; r < this.tilesPerRow; r++) { levelArr[c][r] = 1; } } }, preload: function() { //console.log("bsp2.js - preload()"); game.load.image('img_leveltiles_test', 'leveltiles_test.png'); }, create: function() { //console.log("bsp2.js - create()"); game.add.sprite(0, 0, 'bg_background'); ... this.drawTiles(); }, drawTiles: function() { game.load.tilemap('tilemap', null, [levelArr.toString()], Phaser.Tilemap.TILED_JSON); map = game.add.tilemap('tilemap'); map.addTilesetImage('tileimage', 'img_leveltiles_test', TILE_SIZE, TILE_SIZE); map.create('firstlevel', this.levelWidth/TILE_SIZE, this.levelHeight/TILE_SIZE, TILE_SIZE, TILE_SIZE); }};And this is what a typical array-to-string setup looks like:
  8. So I am trying to import CSV tilemap to my game, using csv collision sample as help. Now it gives this error. Uncaught TypeError: Cannot read property 'width' of undefined which is pointing to this line. Variable map is defined in beginning map = this.game.add.|tilemap('kentta', 20, 20);Preloading is made in external preload.js file, in preload function like this: this.game.load.tilemap('kentta', 'assets/kentta.csv', null, Phaser.Tilemap.CSV);this.game.load.image('tileset', '/assets/tileset.png');
  9. We have a game using Flixel that we are now trying to port to Phaser. The game uses tilemaps made in Dame exported to simple csv files, like this: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,00,0,0,0,1,1,1,1,1,1,1,1,0,0,0,00,0,0,0,1,1,1,1,1,1,1,1,0,0,0,00,0,0,0,1,1,1,1,1,1,1,1,0,0,0,00,0,0,0,1,1,1,1,1,1,1,1,0,0,0,00,0,0,0,1,1,1,1,1,1,1,1,0,0,0,00,0,0,0,1,1,1,1,1,1,1,1,0,0,0,00,0,0,0,1,1,1,1,1,1,2,1,0,0,0,00,0,0,0,1,1,1,1,1,1,1,1,0,0,0,00,0,0,0,1,1,1,1,1,1,1,1,0,0,0,00,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0My question is now, are there any examples to show how to make tilemaps like this work in Phaser? In theory this might be possible but I have seen no examples of it working, only examples using Tiles and json.
×
×
  • Create New...