Page 1 of 1
rotating angle of char? how?
Posted:
Wed Dec 26, 2007 9:14 pm
by stevenp
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 )
Re: rotating angle of char? how?
Posted:
Thu Dec 27, 2007 3:50 pm
by stevenp
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
Re: rotating angle of char? how?
Posted:
Thu Dec 27, 2007 3:52 pm
by Spidy
u mean when your player go to left he cant turn to right?
Re: rotating angle of char? how?
Posted:
Thu Dec 27, 2007 4:27 pm
by MrScience101
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!
Re: rotating angle of char? how?
Posted:
Thu Dec 27, 2007 4:50 pm
by MrScience101
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:
Re: rotating angle of char? how?
Posted:
Thu Dec 27, 2007 4:52 pm
by MrScience101
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.
Re: rotating angle of char? how?
Posted:
Thu Dec 27, 2007 8:12 pm
by MrScience101
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.
The image has strict rules of course. Raw image, 64X64.
Re: rotating angle of char? how?
Posted:
Thu Dec 27, 2007 9:07 pm
by stevenp
ty all
if u have any questins about music or sound, ask away, cuz im a sound/music engeneer/designer
Re: rotating angle of char? how?
Posted:
Fri Dec 28, 2007 2:41 pm
by MrScience101
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.
Re: rotating angle of char? how?
Posted:
Sat Dec 29, 2007 1:08 am
by stevenp
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
Re: rotating angle of char? how?
Posted:
Sat Dec 29, 2007 2:12 am
by Game A Gogo
Actually, angle, directional_velocity, xvelocity and yvelocity can all be used together!
Re: rotating angle of char? how?
Posted:
Sat Dec 29, 2007 1:59 pm
by MrScience101
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.