Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Trouble accessing a game asset from p5js project

A topic by Eugene Lymar created Apr 19, 2020 Views: 234 Replies: 2
Viewing posts 1 to 2

Hi, I'm having trouble loading an asset. 
My game structure is simple:

  • game.zip
    • index.html
    • build/
      • game.js
    • assets/
      • font.otf

I am trying to load the font in, but seem to be getting some XML response. 

I load the font in the js using p5js with loadFont('../assets/font.otf', ...

Is there another way I should be handling this? Are the paths off? 

Thanks!

Moderator(+1)

Since your script is presumably loaded from index.html, the path should be relative to that, I think. Either way, make sure it works on your computer first. That way, if it no longer works after upload, you'll know where the problem is.

Thank you for the reply. That did the trick!

This topic has been auto-archived and can no longer be posted in because there haven't been any posts in a while.