rotating angle of char? how?

Talk about making games.

rotating angle of char? how?

Postby stevenp » Wed Dec 26, 2007 9:14 pm

instead of up down left and right moving my char in those exact directions, i have up as always set to move forward, and back always to walk backwards,

my left and right keys are suposed to rotate my chars angle so the he can turn, iv been trying to figure this out but cant, anyone know how to do this? ( also the speed of turning )
User avatar
stevenp
 
Posts: 403
Joined: Sat Dec 22, 2007 12:49 pm
Location: canada, ontario
Score: 16 Give a positive score

Re: rotating angle of char? how?

Postby stevenp » Thu Dec 27, 2007 3:50 pm

iv been stuck on this for 2 days now, and any help would be appreciated so much, even an explanation of how angles work would be good
User avatar
stevenp
 
Posts: 403
Joined: Sat Dec 22, 2007 12:49 pm
Location: canada, ontario
Score: 16 Give a positive score

Re: rotating angle of char? how?

Postby Spidy » Thu Dec 27, 2007 3:52 pm

u mean when your player go to left he cant turn to right?
Image
VOTE FOR MY SIGNATURE PLEASE.......THANK YOU
User avatar
Spidy
 
Posts: 935
Joined: Tue Aug 14, 2007 1:28 pm
Location: http://www.inatonibai.com
Score: 38 Give a positive score

Re: rotating angle of char? how?

Postby MrScience101 » Thu Dec 27, 2007 4:27 pm

:D Rotation is not easy. The pocket pc simply does not have enough processing power to rotate on the fly. It would just be too slow. You have to cheat to make rotation possible. You need to create an animation that has at least 8 frames. If you want full 360 degree rotation you would need 360 images. When you press the left key you have the animation index increased or decreased so it shows the rotated picture you supplied with the actor. I will see if I can create a quick example. DO NOT USE actor.angle. That is not for rotating the picture, it is used with and in conjuction with actor.directional_velocity. If you initialize actor.angle it disables xvelocity and yvelocity of your actor. Good luck!
User avatar
MrScience101
 
Posts: 115
Joined: Tue Mar 20, 2007 9:52 pm
Score: 13 Give a positive score

Re: rotating angle of char? how?

Postby MrScience101 » Thu Dec 27, 2007 4:50 pm

Here is an example of what I mean by cheating rotation. When you start the game you will see the arrow rotating out of control. Click it with the mouse button to stop it. Then use the left and right keys to rotate the arrow left and right.

Doh! I had to fix the file, apparently if you delete the .undo files it doesn't work. here it is again:
Rotation.zip
cheat_rotation
(7.22 KiB) Downloaded 136 times
Last edited by MrScience101 on Thu Dec 27, 2007 8:07 pm, edited 1 time in total.
User avatar
MrScience101
 
Posts: 115
Joined: Tue Mar 20, 2007 9:52 pm
Score: 13 Give a positive score

Re: rotating angle of char? how?

Postby MrScience101 » Thu Dec 27, 2007 4:52 pm

Alright, one last thing you could possible do, that would be very difficult. You could write your own global function that would load an image into memory. Then you could write another function that would use putpixel to draw the picture on the screen. Finally you could then create your own third function that would rotate the picture pixel by pixel. Needless to say, this would be EXTREMELY slow. Which is why no one does it of course.
User avatar
MrScience101
 
Posts: 115
Joined: Tue Mar 20, 2007 9:52 pm
Score: 13 Give a positive score

Re: rotating angle of char? how?

Postby MrScience101 » Thu Dec 27, 2007 8:12 pm

Alright thanks to mcveighja here is a REAL rotation so you can see how slow it is. It uses canvas and a lot of math. It also crashes when the arrow get's past 360 degrees, because that is when the cos and sin array lookup tables end. It runs fast on the dual core pc I have, but horribly slow on the 200 mhz pocket pc I have. In short, if you are making a pc game, it works okay, but if you are doing it for pocket pc, it is not a good idea because of how slow it is.
Rotate Texture.zip
Rotate Texture
(6.16 KiB) Downloaded 135 times


The image has strict rules of course. Raw image, 64X64.
User avatar
MrScience101
 
Posts: 115
Joined: Tue Mar 20, 2007 9:52 pm
Score: 13 Give a positive score

Re: rotating angle of char? how?

Postby stevenp » Thu Dec 27, 2007 9:07 pm

ty all :D if u have any questins about music or sound, ask away, cuz im a sound/music engeneer/designer
User avatar
stevenp
 
Posts: 403
Joined: Sat Dec 22, 2007 12:49 pm
Location: canada, ontario
Score: 16 Give a positive score

Re: rotating angle of char? how?

Postby MrScience101 » Fri Dec 28, 2007 2:41 pm

I do have a question about music and sound. I am trying to make a game much like the classic "Simon Says" game. It is a game where there are four lights that light up in a sequence. After the sequence is over, you have to click the lights in the same sequence. I need some background music and some musical tones that can play each time a button lights up. To see what I am talking about download this code that is not yet finished, but it will give you the idea. Click on the start button in the game to see what I mean.
Attachments
Simon Says.zip
(111.84 KiB) Downloaded 111 times
User avatar
MrScience101
 
Posts: 115
Joined: Tue Mar 20, 2007 9:52 pm
Score: 13 Give a positive score

Re: rotating angle of char? how?

Postby stevenp » Sat Dec 29, 2007 1:08 am

ok i see ur game, so what kind of music u looking for? anythign specific? what style or feel, i can make anythign from hardcore to elevator music lol
User avatar
stevenp
 
Posts: 403
Joined: Sat Dec 22, 2007 12:49 pm
Location: canada, ontario
Score: 16 Give a positive score

Re: rotating angle of char? how?

Postby Game A Gogo » Sat Dec 29, 2007 2:12 am

Actually, angle, directional_velocity, xvelocity and yvelocity can all be used together!
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: rotating angle of char? how?

Postby MrScience101 » Sat Dec 29, 2007 1:59 pm

Lol well, maybe they fixed it then in the latest version. In my current version 1.3.7 if I let angle = some value it makes it so that xvelocity and yvelocity don't work anymore. Hmmm, or maybe it is because my directional_velocity was =0; Nutz, I am going to have to look into it, you could very well be right.
User avatar
MrScience101
 
Posts: 115
Joined: Tue Mar 20, 2007 9:52 pm
Score: 13 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron