imac2000

Members
  • Content count

    7
  • Joined

  • Last visited

Community Reputation

126 Neutral

About imac2000

  • Rank
    Newbie
  1. HTML5 tile enigne

    well got it working if anyone is have the same trouble, here is a solution it not perfect yet but it may help someone with the same problem   y_offset = Math.round(state.camera_y / state.tile_height); height_offset = Math.round((self.setup.height / state.tile_height) + y_offset) + 1; x_offset = Math.round(state.camera_x / state.tile_width); width_offset = Math.round((self.setup.width / state.tile_width) + x_offset) + 1; if(height_offset > state.map_height) height_offset = state.map_height if(width_offset > state.map_width) width_offset = state.map_width for (var y = y_offset; y < height_offset; y++) { col = state.map_data[y]; for (var x = x_offset; x < width_offset; x++) { color = (state.map_data[y][x]==1)?'#fff':'#000'; self._draw({ type:'rec', x: x * state.tile_width - state.camera_x, y: y * state.tile_height - state.camera_y, width: state.tile_width, height: state.tile_height, fill: color, visible: true },self.ctx); }; };
  2. HTML5 tile enigne

    Hi Palo   thanks I have never heard of lint before will try it out, I will play around with the camera x,y offset values, I am just unsure how exactly I should reduce the map loop.   I have looked into different canvas libs like kinetic limejs and other, but I want to build one so I could understand what was happening under the hood.   currently my lib supports images, sprites animations and simple events   have a look here give it a second or 2 I have added a preloading indicator (click around)   http://code-creative.net/game1/   Thanks again   Ian 
  3. Hi all I have a question about implementing a viewport/camera, I am playing around with the HTML5 canvas and have started to implement a tile engine. At the moment it is massively inefficient, I have a 2d array 100x100 and each frame my code is looping through the whole thing (very bad i know). I would like to use a viewport/camera to determine which area of the area in being view and reduce the rendering loop. here is an example, I haven’t added the camera offset yet because I’m not sure how       for (var y = 0; y < state.map_data.length; y++) {         col = state.map_data[y];         for (var x = 0; x < col.length; x++) {             color = (state.map_data[y][x]==1)?'#fff':'#000';                         self._draw({                 type:'rec',                 x: x * state.tile_width,                 y: y * state.tile_height,                 width: state.tile_width,                 height: state.tile_height,                 fill: color,                 visible: true             },self.ctx);         };     };   here is a link to it http://code-creative.net/game_test/map.html if anyone could give me some advice or point me in right direction that would be great.   Thanks   Ian
  4. HTML5 game development tools

    I use sublime text 2, it has great code complete and zen coding which is nice for html.   there are tools to test in multiple browsers like    https://browserlab.adobe.com/en-us/index.html#   I have to admit I haven't used any i just have chrome and ie open all the time while I've working, I trend to get stuff running in chrome and work backwards to get IE running.
  5. OpenAL

    Hi there I have been playing around with OpenAL and positional sound, I am using corona sdk is there are way to make sound, sound like it is coming from behind a player, if for example if I have a sound positioned at x:0 and y:10 or x:0 and y:-10 the sound balance through each of the speakers seems to be the same. can anyone suggest how I can get a better way to get a better sense of where the sound is emanating from. Thank you for your help Mac
  6. [java] advice please

    Thanks for replying Your right it’s not the learning the code that’s the problem. I have just had a heap of trouble with the sprite handling class which the book uses. It looks like I was trying to find an easy way out by blaming the book. Thanks for your advice. Ian Mac : )
  7. HI there It my first Post. I need your advice about java for games Dev. I have been programming for about 5 year mainly VB, web based scripting languages and Database stuff. I have also produced a game for the GBA using the HAM IDE in C and had a lot of fun doing that. But C was a little frustrating so I thought I would give java a try. I got a simple Java in 24 hours and got start on so simple apps. After that I found a book on Amazon call the black art of java game development or something like but I didn’t check the published date and found out it was printed in 1996 GUTTED. I know that the book will be useful in the sense of OOP principles but would I wasting my time learning some archaic code? If so could you recommend a good book, that wasn’t written at the beginning of time. Thanks Ian Mac