I can’t get my sprite character to show up in my game?
-
What am I missing here?
-
I see a sneaky repeat up on line 12. Unless it's for a special loop (a for loop or while loop) or a normal loop with a break in, your program will get stuck in there and never reach any of the lines below. If that's the case, you'll want to take out the first loop and put everything you need into the second one.
If you haven't already, I recommend going through the tutorials in the help section and/or checking out Dave's coding shorts and video tutorials on YouTube/TikTok! They're super helpful
(https://www.youtube.com/@FUZEArena , https://www.tiktok.com/@fuze_arena ) -
Make sure your variable names don't have spaces in them!
// A space inbetween young and lady will mean FUZE gets confused and will give you an error. young ladyx = gwidth()/2 // it should be like this: youngladyx = gwidth()/2
I would also say that you might want to go for smaller variables names - if just "lady" will do, then you might aswell drop the "young" part - it'll make typing easier in the long run!
Also it seems you are trying to use the sprite properties with the statements like youngladyx and youndladyxscale etc.. What you have there are just individual variables - they won't affect the sprite unless you use those variables in a function like setSpriteScale().
What I think you want is the dot access, to use the sprite properties instead. Try this:
// Program setup backgroundImage = loadImage("Selavi Games/bedroom") backgroundScale = gheight() / imageSize(backgroundImage).y // This gives us a scale multiplier to fit the image perfectly on screen youngLadySpritesheet = loadImage("Pixelsnplpay/Young lady") youngLady = createsprite() setSpriteImage(youngLady, youngLadySpritesheet) // When using sprite properties, you must use the dot (.) to access their properties, like .x or .y: youngLady.x = 0 // When using sprites, (0, 0) is the centre of the screen. Sprites behave differently to other drawing functions like drawImage() youngLady.y = 0 youngLady.xscale = 10 // This might be a bit too big, try a smaller number first. youngLady.yscale = 10 // Main Loop - remember, once we are in an infinite loop like this, the program will stay here. loop clear() drawImage(background, 0, 0, backgroundScale) drawSprites() update() repeat
This should put your sprite in the middle of the screen, appearing over the background as you want.
Making a full game is quite a challenge, and it might be something you should work towards slowly! Make sure you understand the basic concepts well before trying a full game project. The tutorials will help you!
-
Another thought.. Take a good read of the Sprite System document in the FUZE4 Help pages!
-
@dave I would but the print is too small for me on my switch. I just need characters on screen to be Able have a conversation and have one give the medicine.that’s the just of my program.
-
This post is deleted! -
The help that you can access via the drop down box on this forum has a lot on it too and can be viewed on whatever device you are viewing this. Good luck buddy
-
You appear you have a loop before the loop where the sprite gets drawn, if the above loop blocks that loop then the sprite will never be drawn