Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / 2D Sprite Scaling Problem

Author
Message
Allen Moore
21
Years of Service
User Offline
Joined: 28th Jan 2003
Location:
Posted: 29th Jan 2003 19:26
I was attempting to mess around with scaling a 2D sprite, my plan was to use a "for loop" to gradually increase the scale of an object... hoping to get some sort of a top down view jumping effect. When I was done coding, I attempted to run the program, before I was even able to hit my key that was to invoke this effect, my sprite appeared larger and wider. After hitting the button to invoke my "for loop", it didn't seem to do anything. So feeling a bit confused and frustrated, i took out the code, ran the program again a couple of times, even restarting Dark Basic Pro, my sprite kept appearing twice the normal size in my compiled program. Thinking maybe if I restarted my computer, I'd clear the memory and fix the problem I tried that. But my image is still twice the size, and when I tried opening up the image that I'm using for a 2D sprite in an image editor, it looked perfectly normal. I rechecked my code, and I don't have any code that scales the image. Has anyone else ran into this problem? Does anyone have any ideas how I could go about resolving this issue?
haggisman
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 29th Jan 2003 19:37
Can you post the code you are using?

Specs:- 1GHZ athlon, Radeon8500, 192mb ram, winxp
Allen Moore
21
Years of Service
User Offline
Joined: 28th Jan 2003
Location:
Posted: 29th Jan 2003 21:19
Here's my current code with my scaling code readded as it was yesterday for my tank demo i'm working on...



I'm currently at work, so i can't perform any compiling untill later. And second look, I think I need to add some code to smoothly scale it back down to 100%.

BTW, I have my images, added into the "media" area inside Dark Basic Pro for the project, and I even tried removing and re-adding them to try and fix my silly double sized appearnce of my 2d sprites, but that didn't work either.

haggisman
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 29th Jan 2003 23:47
In this section of code



All this code does is scale the tank up and then immediately set it back to normal dimensions before its even synced, and also you shouldn't really use "wait" in your game loop as it will cause pauses that us coders avoid like the plague

This is my quick attempt at fixing it, though it is a little buggy hopefully it will help. Just replace the above code with this.



Specs:- 1GHZ athlon, Radeon8500, 192mb ram, winxp
Allen Moore
21
Years of Service
User Offline
Joined: 28th Jan 2003
Location:
Posted: 30th Jan 2003 01:06
Sweet! Thank you, it works pretty good!

Login to post a reply

Server time is: 2024-11-23 23:15:49
Your offset time is: 2024-11-23 23:15:49