Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • scorpion832: Join the Best Rs2/Pre-EOC RSPS ---> [link] <---- Massive community
      Today at 03:19:44 AM
    • bald1995: Bonjour
      August 09, 2020, 02:18:42 AM
    • ragnoroker: Come join RuneGuild today! Join added automated PVP tournmanents with group stages! - RuneGuild is a New OSRS Server with PVM/Pk balance with a great economy and friendly players. Join now : [link]
      August 02, 2020, 11:07:56 PM
    • ragnoroker: Come join RuneGuild today! Join added automated PVP tournmanents with group stages! - RuneGuild is a New OSRS Server with PVM/Pk balance with a great economy and friendly players. Join now : [link]
      August 02, 2020, 11:07:53 PM
    • draholic: slayerpure idk why and cant remember but im banned there lol
      August 01, 2020, 12:57:47 PM
    • slayerpure: come check out new lit server! need players and staff. free m box to noobs        [link]      [link]
      July 30, 2020, 07:21:51 PM
    • JorgeFloyd: anal anus arrse arse ass-fudgeer asses assfudgeer assfukka asshole assholes asswhole a_s_s ballbag ballsack bastard beastial beastiality bellend bestial bestiality biatch bitch bitcher bitchers bitches bitchin bitching blowjob blowjobs boiolas bollock bollok boner boob boobies boobs booobs boooobs booooobs booooooobs breasts buceta bugger butthole buttmuch buttplug cawk chink cipa clit clitoris clits cnut penis penis-sucker penisface penishead penismunch penismuncher peniss penissuck penissucked penissucker penissucking penissucks penissuka penissukka cokmuncher coksucka coon cummer cumming cums cumshot cunilingus cunillingus cunnilingus runt runtlick runtlicker runtlicking runts cyalis cyberfuc cyberfudge cyberfudgeed cyberfudgeer cyberfudgeers cyberfudgeing dick dickhead dildo dildos dink dinks dirsa dlck dog-fudgeer doggin dogging donkeyribber doosh duche dyke ejaculate ejaculated ejaculates ejaculating ejaculatings ejaculation ejakulate fag fagging faggitt faggot faggs fagot fagots fags fanny fannyflaps fannyfudgeer fanyy fatass fcuk fcuker fcuking feck fecker felching fellate fellatio fingerfudge fingerfudgeed fingerfudgeer fingerfudgeers fingerfudgeing fingerfudges fistfudge fistfudgeed fistfudgeer fistfudgeers fistfudgeing fistfudgeings fistfudges flange fook fooker fudge fudgea fudgeed fudgeer fudgeers fudgehead fudgeheads fudgein fudgeing fudgeings fudgeingshitmotherfudgeer fudgeme fudges fudgewhit fudgewit fudgepacker fuk fuker fukker fukkin fuks fukwhit fukwit fux f_u_c_k gangbang gangbanged gangbangs gaylord gaysex goatse god-dam god-damned goddamn goddamned hardcoresex heshe hoar hoare hoer homo horniest horny hotsex jack-off jackoff jerk-off jism jiz jizm jizz kawk knob knobead knobed knobend knobhead knobjocky knobjokey kock kondum kondums kum kummer kumming kums kunilingus labia lmfao lust lusting masochist master-bate masterbate masterbation masterbations masturbate mo-fo mofo mothafudge mothafudgea mothafudgeas mothafudgeaz mothafudgeed mothafudgeer mothafudgeers mothafudgein mothafudgeing mothafudgeings mothafudges motherfudge motherfudgeed motherfudgeer motherfudgeers motherfudgein motherfudgeing motherfudgeings motherfudgeka motherfudges mutha muthafecker muthafudgeker mutherfudgeer nazi nigga niggah niggas niggaz African Africans nobhead nobjocky nobjokey numbnuts nutsack orgasim orgasims orgasm orgasms pawn pecker penis penisfudgeer phonesex phuck phuk phuked phuking phukked phukking phuks phuq pigfudgeer pimpis piss pissed pisser pissers pisses pissflaps pissin pissing pissoff poop prawns prawnso prawnsography prawnsos prick pricks pube pusse pussi pussies pussy pussys rectum retard rimjaw s.o.b. sadist schlong screwing scroat scrote scrotum semen sex sh!t shag shagger shaggin shagging shemale shi+ shit shitdick shite shited shitey shitfudge shitfull shithead shiting shitings shits shitted shitter shitters shitting shittings shitty skank slut sluts smegma smut snatch son-of-a-bitch spunk s_h_i_t teets teez testical testicle titfudge tits titt tittiefudgeer titties tittyfudge tittywank titwank tosser twat twathead twatty twunt twunter vagina viagra vulva wang wank wanker wanky whoar whore willies willy xrated xxx gay
      July 20, 2020, 06:43:34 PM
    • slayerpure: come check out a new server just got up yesterday!!!!     [link]
      July 20, 2020, 01:28:20 PM
    • slayerpure: join a new custom server! looking for staff and new players get loot boxes        [link]
      July 16, 2020, 09:04:22 PM
    • chaosgirl: Fix these forums, jesus. all the spam!!
      July 16, 2020, 04:43:19 AM
    • Shady Aftermath: Skyfire317, The Only Server With Warding,Divination,Archaeology, AFK Auto Upgrade LINK HERE -> [link]
      July 16, 2020, 02:34:19 AM
    • Shady Aftermath: Skyfire317, The Only Server With Warding,Divination,Archaeology, AFK Auto Upgrade LINK HERE -> [link]+
      July 16, 2020, 02:34:15 AM
    • Shady Aftermath: Skyfire317, The Only Server With Warding,Divination,Archaeology, AFK Auto Upgrade LINK HERE -> [link]+
      July 16, 2020, 02:34:10 AM
    • Shady Aftermath: Skyfire317, The Only Server With Warding,Divination,Archaeology, AFK Auto Upgrade LINK HERE -> [link]
      July 16, 2020, 02:34:04 AM
    • Shady Aftermath: Skyfire317, The Only Server With Warding,Divination,Archaeology, AFK Auto Upgrade [link]
      July 16, 2020, 02:33:33 AM
    • slayerpure: custom server with goku, vegeta, darth vader, rick and morty, joker, and world boss. join now here!!!  [link]
      July 11, 2020, 08:35:27 PM
    • dan v jad: PkOwnage! 2 Worlds! Come join us!  [link]  Join us on Discord! [link]  Download Mirrors: [link]
      July 11, 2020, 10:50:02 AM
    • Shady Aftermath: Skyfire317, The Only Server With Warding,Divination,Archaeology, AFK Auto Upgrade [link]
      July 09, 2020, 12:09:03 AM
    • Shady Aftermath: Skyfire317, The Only Server With Warding,Divination,Archaeology, AFK Auto Upgrade [link]
      July 09, 2020, 12:08:59 AM
    • Shady Aftermath: Skyfire317, The Only Server With Warding,Divination,Archaeology, AFK Auto Upgrade [link]
      July 09, 2020, 12:08:51 AM

    Author Topic: (Array)Html5 Map? Is there any other way?  (Read 3514 times)

    0 Members and 2 Guests are viewing this topic.

    Offline317guy

    • Member
    • ***
    • Posts: 241
    • Thanks: +0/-0
      • View Profile
    (Array)Html5 Map? Is there any other way?
    « on: May 04, 2016, 07:49:11 AM »
    Was just curious is there any other way to program a map in JavaScript
    using a different method besides arrays, below is just a small way of how i am rendering my maps
    however my map is now huge and it is very bothersome to find the area i wish too edit. I am also using the array elements for collision.
    if anyone knows of a different method please share. or you can just flame me for my code.

    (click to show/hide)
    Runescape Gambling

    OfflineBowser jr

    • Member
    • ****
    • Posts: 6,001
    • Thanks: +0/-0
      • View Profile
    Re: (Array)Html5 Map? Is there any other way?
    « Reply #1 on: May 04, 2016, 09:04:39 AM »
    You probably want to generate the map from a mapdata file, and not hardcode stuff like this.

    Offline317guy

    • Member
    • ***
    • Posts: 241
    • Thanks: +0/-0
      • View Profile
    Re: (Array)Html5 Map? Is there any other way?
    « Reply #2 on: May 04, 2016, 09:20:10 AM »
    You probably want to generate the map from a mapdata file, and not hardcode stuff like this.
    Do you think you could point me in the right direction? any information or website would be great  :)

    OfflineBowser jr

    • Member
    • ****
    • Posts: 6,001
    • Thanks: +0/-0
      • View Profile
    Re: (Array)Html5 Map? Is there any other way?
    « Reply #3 on: May 04, 2016, 12:55:26 PM »
    Just look how other people implement their maps.

    OfflineDeath Style

    • Member
    • ****
    • Posts: 569
    • Thanks: +0/-0
      • View Profile
    Re: (Array)Html5 Map? Is there any other way?
    « Reply #4 on: May 05, 2016, 10:29:54 AM »
    is this a static image?

    using arrays is your best bet but you can make it easier

    Code: Javascript
    1. var loadImage =(url)=>new Promise((resolve, reject)=>{
    2.   var img =new Image();
    3.   img.onload=()=> resolve(img);
    4.   img.onerror=(err)=> reject(err);
    5.   img.src= url;
    6. });
    7.  
    8. var loadImages =(imgUrls)=> Promise.all(imgUrls.map(loadImage));
    9.  
    10. var drawMap =(tiles, tileImgs, context)=>{
    11.   var tileHeight = tileImgs[0].height;
    12.   var tileWidth = tileImgs[0].width;
    13.   tiles.forEach((row, y)=> row.forEach((tileID, x)=> context.drawImage(tileImgs[tileID], x * tileWidth, y * tileHeight)));
    14. };
    15.  
    16. var imgUrls =[
    17.   'Grass.png',
    18.   'Rock.png',
    19.   'Sand.png'
    20. ];
    21.  
    22. var map =[
    23.   [0,0,0],
    24.   [1,1,1],
    25.   [2,2,2]
    26. ];
    27.  
    28. var context;// something...
    29.  
    30. loadImages(imgUrls).then(tileImgs => drawMap(map, tileImgs, context));
    31.  

    the ID in your 2d map array correlates with the index in imgUrls, so you don't need to check each one individually

    you'll get the first row of grass, then rock, then sand
    « Last Edit: May 05, 2016, 12:02:27 PM by Death Style »

    Offline317guy

    • Member
    • ***
    • Posts: 241
    • Thanks: +0/-0
      • View Profile
    Re: (Array)Html5 Map? Is there any other way?
    « Reply #5 on: May 05, 2016, 12:57:05 PM »
    is this a static image?

    using arrays is your best bet but you can make it easier

    Code: Javascript
    1. var loadImage =(url)=>new Promise((resolve, reject)=>{
    2.   var img =new Image();
    3.   img.onload=()=> resolve(img);
    4.   img.onerror=(err)=> reject(err);
    5.   img.src= url;
    6. });
    7.  
    8. var loadImages =(imgUrls)=> Promise.all(imgUrls.map(loadImage));
    9.  
    10. var drawMap =(tiles, tileImgs, context)=>{
    11.   var tileHeight = tileImgs[0].height;
    12.   var tileWidth = tileImgs[0].width;
    13.   tiles.forEach((row, y)=> row.forEach((tileID, x)=> context.drawImage(tileImgs[tileID], x * tileWidth, y * tileHeight)));
    14. };
    15.  
    16. var imgUrls =[
    17.   'Grass.png',
    18.   'Rock.png',
    19.   'Sand.png'
    20. ];
    21.  
    22. var map =[
    23.   [0,0,0],
    24.   [1,1,1],
    25.   [2,2,2]
    26. ];
    27.  
    28. var context;// something...
    29.  
    30. loadImages(imgUrls).then(tileImgs => drawMap(map, tileImgs, context));
    31.  

    the ID in your 2d map array correlates with the index in imgUrls, so you don't need to check each one individually

    you'll get the first row of grass, then rock, then sand
    Thanks for the upgrade hahaha, Just wondering do you think it is possible to load the data from a image file so instead of  0 = grass, a pixel of green on the image file would represent the grass image?

    OfflineDeath Style

    • Member
    • ****
    • Posts: 569
    • Thanks: +0/-0
      • View Profile
    Re: (Array)Html5 Map? Is there any other way?
    « Reply #6 on: May 06, 2016, 04:48:03 AM »
    you could map the image file of green/brown/tan to an array of 0/1/2 and then run it through that to get grass/rock/sand

    you'd need to list the rgba values in the same order and map them over a Uint32Array view of the imagedata

    Offlinechillwitm888

    • Member
    • ****
    • Posts: 1,721
    • Thanks: +0/-0
      • View Profile
    Re: (Array)Html5 Map? Is there any other way?
    « Reply #7 on: May 19, 2016, 06:09:41 AM »
    if you want to generate a map, why not just use google maps?
    Google has their map Api open and you can use their placepicker API to plot ur points. Its fairly intuitive
    No need to build something thats already been built

    Offlinejustaguy

    • Member
    • ****
    • *
    • Posts: 706
    • Thanks: +0/-0
      • View Profile
    Re: (Array)Html5 Map? Is there any other way?
    « Reply #8 on: May 19, 2016, 09:14:54 AM »
    if you want to generate a map, why not just use google maps?
    Google has their map Api open and you can use their placepicker API to plot ur points. Its fairly intuitive
    No need to build something thats already been built

    He wants to make a game world.
    RIP

    Offline317guy

    • Member
    • ***
    • Posts: 241
    • Thanks: +0/-0
      • View Profile
    Re: (Array)Html5 Map? Is there any other way?
    « Reply #9 on: August 15, 2016, 03:56:37 AM »
    if you want to generate a map, why not just use google maps?
    Google has their map Api open and you can use their placepicker API to plot ur points. Its fairly intuitive
    No need to build something thats already been built

    He wants to make a game world.
    ^
     |

    OfflineKamnarce

    • First Time Poster
    • *
    • Posts: 4
    • Thanks: +10/-10
      • View Profile
    Re: (Array)Html5 Map? Is there any other way?
    « Reply #10 on: August 10, 2019, 04:55:54 AM »
    will this copy career stats too, or just ratings?

    and when I create a new league file, there is no free agent pool, so what am I copying over?

     

    Copyright © 2017 MoparScape. All rights reserved.
    Powered by SMFPacks SEO Pro Mod |
    SimplePortal 2.3.5 © 2008-2012, SimplePortal