Spherical forums

Sphere Development => Sphere Support => Script Support => Topic started by: Harry Bo21 on April 08, 2016, 01:48:31 pm

Title: Back again, hitting issues
Post by: Harry Bo21 on April 08, 2016, 01:48:31 pm
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?

(https://i.gyazo.com/15df9545b0072820c1ba54d9f9122455.png)

this code works on sphere 1.6 ( which i previously used ) but tells me its "not a sphere image" on minisphere?
Title: Re: Back again, hitting issues
Post by: DaVince on April 08, 2016, 02:23:44 pm
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();
Title: Re: Back again, hitting issues
Post by: DaVince on April 08, 2016, 02:34:49 pm
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
Title: Re: Back again, hitting issues
Post by: Harry Bo21 on April 08, 2016, 08:58:09 pm
thanks DaVince, ill be sure to try that out :)