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 / Help for the new one

Author
Message
zapoqx
18
Years of Service
User Offline
Joined: 22nd Apr 2006
Location: Tempe,AZ
Posted: 23rd Apr 2006 01:15
Hey, I havn't been here before but I have done a bit of DarkBasic PRO for programming class. I just have a question...
One of my projects, I am trying to make 2 paddles for something that is similar to a pong game except it has breakout elements. I need the 2 paddles to rotate within a center circle (which is what has me stumped since I don't know how to go about it). Can anyone help me with this portion?

Thanks in advance!
Mikey P
19
Years of Service
User Offline
Joined: 23rd May 2005
Location: Manchester, UK
Posted: 23rd Apr 2006 01:54 Edited at: 23rd Apr 2006 02:05
If I understand you correctly, aslong as the graphics for your two paddles, are the same shape as the circle, simple have them as sprites, and use the Sprite Offset command and give it the co-ordinates for the centre of the circle, do this for both paddles. Then using the sprite rotation commands *should* rotate them in the way you want them to.

That's if I understood you correctly.

[Edit]



Is that the type of thing you were talking about? 'Cos that's sure what I was talking about...

Attachments

Login to view attachments
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 23rd Apr 2006 02:49 Edited at: 23rd Apr 2006 02:50
Im assuming you're fairly new to DBP judging fro what you're trying to accomplish here, so Ill go about this using an extremely basic method.

First off, lets think of wat you're trying to accomplish. You want the paddle to move left when the left movement button is pressed (lets say the left arrow key for now), and right when the right key is pressed (right arrow key). Also, you need the object to stay in a circular pattern, in other words moving around a pivot point while maintaining the same distance from the object at all times.

There are a few ways of accomplishing this, 4 main ones basically;

- Use a mathematical formula to calculate the object's new X,Y and Z position (fairly hard)
- Use a limb to determine the positioning of the paddles, and then instead of moving the paddles you rotate the limb (not too hard, but not needed for something like this)
- Position the object at the pivot point, rotate it, and then move it backwards to the radius of the circle (getting easier)
- Just use the object rotation/side movement commands to move the object. (we'll use this one)

So, first off these are the commands we're going to be looking into for this;

POINT OBJECT, MOVE OBJECT RIGHT, MOVE OBJECT LEFT

First off, lets setup the basic program layout;



Hopefully you understand what thats doing so far. Run it and youll basically just see a box.

Now lets add some basic left and right movement to the box, add this code inside the main loop:



Running that you'l now have the ability to move the paddle left and right.

Now we'll add in the rotation. The POINT OBJECT command will point an object to a 3D coordinate. So, we'll use the POINT OBJECT command to make sure object 1 (our paddle) is always pointing towards 0,0,0 (the center). Add this code after the movement code;



Now run the code and youll see that you can move left and right, while the paddle folows a circular path.

Summing up the end code will be;



Hope this sheds some light on things,
- RUC'

Oh, and welcome to the forums

Mikey P
19
Years of Service
User Offline
Joined: 23rd May 2005
Location: Manchester, UK
Posted: 23rd Apr 2006 03:05
Bleh, I immediately assumed 2d, sorry! My post is made mostly useless now ^.^

zapoqx
18
Years of Service
User Offline
Joined: 22nd Apr 2006
Location: Tempe,AZ
Posted: 23rd Apr 2006 03:32
Sorry, I didn't respond sooner, I was being driven home from the school that had the program.

Ok, I am thinking of it in a 2d perspective overhead. I'll see if this trial version I have here that came with my book will work with some of the code so I can better understand what is being said.
zapoqx
18
Years of Service
User Offline
Joined: 22nd Apr 2006
Location: Tempe,AZ
Posted: 23rd Apr 2006 03:47
Sorry to double post but I'm not sure if I can edit anything yet with my limitations as a new user.

Uh, After looking at the code, the 3D one would essentially work but in class, we only gone over 3D Twice and I'm not fully comfortable enough to do 3D yet.
Mikey P
19
Years of Service
User Offline
Joined: 23rd May 2005
Location: Manchester, UK
Posted: 23rd Apr 2006 12:41
Have you used 2d, as I could walk you through the basics in 2d, however, does my diagram match the idea you have? Because I can't carry on helping you make that game, if your vision is something completely different .

zapoqx
18
Years of Service
User Offline
Joined: 22nd Apr 2006
Location: Tempe,AZ
Posted: 23rd Apr 2006 22:25
I havn't used 2D much since alot of the class was making a Tile (which I still don't understand) and text stuff (which I can do in qBasic if I wanted to) and using code made and finishing it up. Since we're required to make as our option either 2D or 3D to make a game.

Yes, what your diagram shows is exactly what I am talkin about. From my understanding, I gotta make a sprite, correct?
First Person Shooters
18
Years of Service
User Offline
Joined: 23rd Apr 2006
Location: UK
Posted: 27th Apr 2006 14:01
for making a 2D game id recomend using the software gamemaker(can be downloaded form www.gamemaker.nl) this allows you to create basic 2D games and comes with easy to follow tutorials, for 3D darkbasic Pro is defo the best, id recomend the pro edition because it has a programming language to lean(not unless you know C/C++ then go for SDK)

its pointless jumping into code you dont understand, i used to use gamemaker for me 2D titles and now want to move onto 3D so i chose DarkBasic,gamemaker offers 3D but isnt as good.

Hope this has been some help to you, if not and you still want to begin using BD or DB pro id suggest going though as many tutorials as you can until you are a compitant programmer, once you are happy then create your own titles. Dont do what many do and jump straight in as you will only get puzzled and alot of headaches lol.

(1)create something new, (2)update that something new to make it more enjoyable and look nicer, (3)when bored of that idea repeat (1)

Login to post a reply

Server time is: 2024-09-24 21:27:12
Your offset time is: 2024-09-24 21:27:12