Computer Science Canada Space game start |
Author: | paulkwatyra [ Sun Dec 18, 2005 11:46 am ] |
Post subject: | Space game start |
Hey i a while back i made this game called ball bombs now im incorperating graphics into the game and i need help on how to rotate my ships instead of them just moving side to side so any help would be apreciated |
Author: | MysticVegeta [ Sun Dec 18, 2005 12:36 pm ] |
Post subject: | |
Then you need a 3d engine my friend. Unless you plan to rotate it 2D which will look crappy.... Are you sure you can handle 3D Images? |
Author: | paulkwatyra [ Sun Dec 18, 2005 12:50 pm ] |
Post subject: | |
lol i dont think so isnt there some way just to rotate it? |
Author: | pavol [ Sun Dec 18, 2005 1:05 pm ] | ||
Post subject: | |||
you can use Pic.Rotate for example
im not 100% sure how it works but if you mess around with it for a while you should understand hope it helps |
Author: | paulkwatyra [ Sun Dec 18, 2005 1:16 pm ] |
Post subject: | |
Yes but wouldnt that jump it from lest say if its going straight to the left? |
Author: | pavol [ Sun Dec 18, 2005 1:23 pm ] |
Post subject: | |
i don't understand, what do you mean by 'jump it' |
Author: | paulkwatyra [ Sun Dec 18, 2005 1:35 pm ] |
Post subject: | |
like it wouldnt be a smooth transition for rotatating it |
Author: | pavol [ Sun Dec 18, 2005 1:47 pm ] |
Post subject: | |
you're right it wouldn't, but one thing you can do is store a rotated version of the picture for every degree 1 - 360 in an array and then when the user turns the ship right, for example, just display the ship at the 1st degree then the 2nd and so on to 90 degrees. the only problem with that is that it will probably make your game slower. |
Author: | Cervantes [ Sun Dec 18, 2005 4:45 pm ] |
Post subject: | |
It would make your game slower, because you are storing a bunch of pictures. But there's nothing you can do about it. (Well, you don't have to store 360 pictures. Storing 72 or 36 pictures looks fine.) Furthermore, it's a heck of a lot better than rotating the pictures in the loop: Pic.Rotate is a slow function. I haven't looked at your code, but it sounds as if you should read zylum's rotation tutorial AsianSensation also wrote a tutorial on the same topic. |
Author: | pavol [ Sun Dec 18, 2005 6:54 pm ] |
Post subject: | |
oh, and i forgot to mention something for your game. you might wanna use View.Update so there is no more flicker just a suggestion |
Author: | Albrecd [ Sun Dec 18, 2005 6:58 pm ] | ||
Post subject: | |||
Quote: im not 100% sure how it works but if you mess around with it for a while you should understand
Pic2 := Pic.Rotate (Pic1 [picture that you want to rotate], x, y [x, y is the point around which you want the picture to rotate]) Quote: you're right it wouldn't, but one thing you can do is store a rotated version of the picture for every degree 1 - 360 in an array
You definatly don't need 360 pictures, 36 usually works nicely. You could try:
Then you draw pic (#) depending on what angle you what the picture at. %NOTE: this code will rotate the picture around it's centre. |
Author: | Albrecd [ Sun Dec 18, 2005 7:04 pm ] |
Post subject: | |
MysticVegeta Said: Quote: Then you need a 3d engine...
Why would you need a 3D engine? |
Author: | pavol [ Sun Dec 18, 2005 7:15 pm ] | ||
Post subject: | |||
Quote: Well, you don't have to store 360 pictures
Quote: You definatly don't need 360 pictures
ok, i was exaggerating. Albrecd a for loop would make that code a bit easier. ![]()
|
Author: | Albrecd [ Sun Dec 18, 2005 7:45 pm ] | ||||||
Post subject: | |||||||
I don't mean to be critical and I definatly think that a for loop is the way to go but the code you posted: Quote:
Will return an error because you have not declared all of your variables. Instead of
you need
Otherwise it tries to use i as a subscript for picR rather than using it to determine which picR to use. |
Author: | pavol [ Sun Dec 18, 2005 7:52 pm ] |
Post subject: | |
typo. forgot about that part. you're right |