Computer Graphics

Moderators: Sephiroth
Number of threads: 1241
Number of posts: 2641

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Edit Report
help with sprites.... Posted by <^TiGerClaW_333^& on 21 Jul 2000 at 1:36 AM
how can i turn and rotate sprites in VB?


Edit Report
Re: help with sprites.... Posted by LordAsm on 21 Jul 2000 at 9:28 AM
: how can i turn and rotate sprites in VB?<br>
: <br>
<br>
To turn sprites in vb, you must exchange the image box coordinates properties. For example: you have the coordinates (x1,y1)-(x2, y2), you only change the values of x1 to x2 and x2 to x1, to flip it horizontally, and change y1 to y2 and y2 to y1 to flip vertically. To rotate the bitmap, you needed to resize the bitmap, and make sine and cossine calcs. This is VERY COMPLICATED AND STUPID TO DO in VB.<br>
If, with this, you are planning to make a game, QUIT IT NOW!!!! Visual Basic is not a gaming-purpose language. It is not made to allow game making. Learn C and Assembly. They are not hard languages and they are very useful since games like WarCraft II and Diablo are made off..<br>
<br>
- LordAsm -<br>



Edit Report
Re: help with sprites.... Posted by lego1403 on 23 Jul 2000 at 8:16 PM
: how can i turn and rotate sprites in VB?<br>
: <br>
And this is difficult question if you want to rotate on 1,2,3,...etc degrees. Rotating on 90 degrees is the easiest you can do, but how to solve this problem?<br>
<br>
Of course use cos, sin and other math things, but the problem is that if you rotate on 15 degrees there exist some black holes in your sprite!<br>
<br>
how to solve this?<br>
Oleg<br>
<br>
<br>



URL:www.hot.ee/olegus

Edit Report
Re: Re: help with sprites.... Posted by KMS on 26 Jul 2000 at 11:19 AM
I think you can get rid of the holes by rotating from target to source instead of the other way,<br>
<br>
s = source, t = target, c = center<br>
<br>
xt = xc + xs * cos ==> xs = ( xt - xc ) / cos<br>
yt = yc - ys * sin ==> ys = -( yt - yc ) / sin<br>
<br>
so first find the 4 boundary points<br>
<br>
x1 = xc + ( -width/2 ) * cos<br>
x2 = xc + ( +width/2 ) * cos<br>
y1 = yc - ( -height/2 ) * sin<br>
y2 = yc - ( +height/2 ) * sin<br>
<br>
and now you do:<br>
for( yt = y1; yt <= y2; yt++ )<br>
for( xt = x1; xt <= x2; xt++ )<br>
{<br>
xs = ( xt - xc ) / cos<br>
ys = -(yt - yc ) / sin<br>
<br>
// need to check if pixel is in sprite, remember, we are testing the big box of the rotated image<br>
if( xs >= 0 && xs < width && ys >= 0 && ys < height )<br>
{<br>
color = color_from_sprite( xs, ys );<br>
draw( xt, yt, color );<br>
}<br>
}<br>
<br>
Hope this was helpful<br>
<br>
: : how can i turn and rotate sprites in VB?<br>
: : <br>
: And this is difficult question if you want to rotate on 1,2,3,...etc degrees. Rotating on 90 degrees is the easiest you can do, but how to solve this problem?<br>
: <br>
: Of course use cos, sin and other math things, but the problem is that if you rotate on 15 degrees there exist some black holes in your sprite!<br>
: <br>
: how to solve this?<br>
: Oleg<br>
: <br>
: <br>
: <br>
: <br>
<br>



Edit Report
to all who replied to the original messege.... Posted by &lt;^TiGerClaW_333^& on 27 Jul 2000 at 12:28 AM
look bros i was actually asking for help with VB. i'm not sure if i mentioned this but if i haven't then i'm sorry. and do you think you could tell me how to do that in VB and not VC or C whichever you told me in???<br>
<br>
: I think you can get rid of the holes by rotating from target to source instead of the other way,<br>
: <br>
: s = source, t = target, c = center<br>
: <br>
: xt = xc + xs * cos ==> xs = ( xt - xc ) / cos<br>
: yt = yc - ys * sin ==> ys = -( yt - yc ) / sin<br>
: <br>
: so first find the 4 boundary points<br>
: <br>
: x1 = xc + ( -width/2 ) * cos<br>
: x2 = xc + ( +width/2 ) * cos<br>
: y1 = yc - ( -height/2 ) * sin<br>
: y2 = yc - ( +height/2 ) * sin<br>
: <br>
: and now you do:<br>
: for( yt = y1; yt <= y2; yt++ )<br>
: for( xt = x1; xt <= x2; xt++ )<br>
: {<br>
: xs = ( xt - xc ) / cos<br>
: ys = -(yt - yc ) / sin<br>
: <br>
: // need to check if pixel is in sprite, remember, we are testing the big box of the rotated image<br>
: if( xs >= 0 && xs < width && ys >= 0 && ys < height )<br>
: {<br>
: color = color_from_sprite( xs, ys );<br>
: draw( xt, yt, color );<br>
: }<br>
: }<br>
: <br>
: Hope this was helpful<br>
: <br>
: : : how can i turn and rotate sprites in VB?<br>
: : : <br>
: : And this is difficult question if you want to rotate on 1,2,3,...etc degrees. Rotating on 90 degrees is the easiest you can do, but how to solve this problem?<br>
: : <br>
: : Of course use cos, sin and other math things, but the problem is that if you rotate on 15 degrees there exist some black holes in your sprite!<br>
: : <br>
: : how to solve this?<br>
: : Oleg<br>
: : <br>
: : <br>
: : <br>
: : <br>
: <br>
: <br>
: <br>
<br>



Edit Report
Re: to all who replied to the original messege.... Posted by Alhab Azrab on 28 Jul 2000 at 8:50 AM
Try to understand!<br>
it can't be done with VB!<br>
VB is way too slow, and crappy.<br>
<br>
: look bros i was actually asking for help with VB. i'm not sure if i mentioned this but if i haven't then i'm sorry. and do you think you could tell me how to do that in VB and not VC or C whichever you told me in???<br>
: <br>
: : I think you can get rid of the holes by rotating from target to source instead of the other way,<br>
: : <br>
: : s = source, t = target, c = center<br>
: : <br>
: : xt = xc + xs * cos ==> xs = ( xt - xc ) / cos<br>
: : yt = yc - ys * sin ==> ys = -( yt - yc ) / sin<br>
: : <br>
: : so first find the 4 boundary points<br>
: : <br>
: : x1 = xc + ( -width/2 ) * cos<br>
: : x2 = xc + ( +width/2 ) * cos<br>
: : y1 = yc - ( -height/2 ) * sin<br>
: : y2 = yc - ( +height/2 ) * sin<br>
: : <br>
: : and now you do:<br>
: : for( yt = y1; yt <= y2; yt++ )<br>
: : for( xt = x1; xt <= x2; xt++ )<br>
: : {<br>
: : xs = ( xt - xc ) / cos<br>
: : ys = -(yt - yc ) / sin<br>
: : <br>
: : // need to check if pixel is in sprite, remember, we are testing the big box of the rotated image<br>
: : if( xs >= 0 && xs < width && ys >= 0 && ys < height )<br>
: : {<br>
: : color = color_from_sprite( xs, ys );<br>
: : draw( xt, yt, color );<br>
: : }<br>
: : }<br>
: : <br>
: : Hope this was helpful<br>
: : <br>
: : : : how can i turn and rotate sprites in VB?<br>
: : : : <br>
: : : And this is difficult question if you want to rotate on 1,2,3,...etc degrees. Rotating on 90 degrees is the easiest you can do, but how to solve this problem?<br>
: : : <br>
: : : Of course use cos, sin and other math things, but the problem is that if you rotate on 15 degrees there exist some black holes in your sprite!<br>
: : : <br>
: : : how to solve this?<br>
: : : Oleg<br>
: : : <br>
: : : <br>
: : : <br>
: : : <br>
: : <br>
: : <br>
: : <br>
: <br>
: <br>
: <br>
<br>






 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.