Skip to main content

News

Topic: Back again, hitting issues (Read 4140 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
Back again, hitting issues
Hey all, i decided to return, give my old metroid side scroller another go

having all sorts of issues when trying to do this via minisphere tho

Can someone direct me to some materials to read to re-aquaint myself?



this code works on sphere 1.6 ( which i previously used ) but tells me its "not a sphere image" on minisphere?

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: Back again, hitting issues
Reply #1
I think the problem is that, by replacing an Image with a Surface, you're directly injecting a Surface object into a place where minisphere expects there to be an Image object. Thus, your sprite will now have an array of sprite frames that looks like [Surface, Image, Image, Image, ...]. Thing is, the map engine, or really, minisphere itself, wouldn't really be able to handle that because it internally just expects an array of just Images. It's actually pretty interesting that original Sphere didn't have an issue with this (I guess it didn't care about the type, just the available properties and methods).

Try creating a copy of this.images instead of directly referencing the images in the sprite.

Edit: just to be clear, the solution is basically to store the newly created surface in its own variable rather than overwriting the Image.

Code: [Select]
this.surfaces = [];
this.surfaces[0] = this.images[0].createSurface();
  • Last Edit: April 08, 2016, 02:29:08 pm by DaVince

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: Back again, hitting issues
Reply #2
By the way, you ARE free to replace the sprite frames with actual images, and it'll work. For example:

Code: [Select]
sprite.images[0] = new Image("images/mything.png");


new Image(), new Spriteset() etc. are new functions in minisphere, by the way. See this page for changes and additions pertaining to minisphere specifically: https://github.com/fatcerberus/minisphere/blob/master/docs/sphere-api.txt

Re: Back again, hitting issues
Reply #3
thanks DaVince, ill be sure to try that out :)