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.

DarkBASIC Discussion / Making object do half circle with New(x,y)values (help please)

Author
Message
UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 7th Mar 2006 14:30 Edited at: 7th Mar 2006 14:31
Ok. I am making a 2d game in 3d because of the ability to rotate the objects and such.
There is a plain at 0,0,0 that is the background. The camera is at 0,0,10 looking at the plain. And all the player objects and aliens and stuff is in the z value of -1. It has all worked. But I need some help with the use of newxvalue and newyvalue to calculate the boss' position.
Here is an image about how I want to move the boss.



I am fine with it always pointing at the center, but I can't get it to do that half-circle. The z value of the boss is always -1, and the zangle of the boss object has the angle in which it is pointing.
Here is what I have been using to position it:
Position object 9+I,newxvalue(0,Alien#(I,4),20),newyvalue(0,Alien#(I,4),10),-1
but all it does is make it go in a diagonal line from the bottom right corner of the screen to the top left corner of the screen. (In a line, not curvy like a half circle.

What should I use to position it like the image?

Attachments

Login to view attachments
General Sephiro
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location:
Posted: 7th Mar 2006 15:00 Edited at: 7th Mar 2006 15:03
USE WAYPOINTS!

you can point the object at each waypoint move it forward then point it back at the camera.

Waypoint information can be stored inside variables..

E.g. The waypoint data can be gotten within the game simply move the boss character around using up and down whilst recording the X,Y positions where you want him to go... from your diagram i'd say there is about 5 waypoints


UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 7th Mar 2006 15:08
Great idea! Thanks

Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 7th Mar 2006 18:49
I'd just keep pointing at the center, and move the boss left and right. Until it finished its half circle, then it has to go the other way.

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 7th Mar 2006 19:49 Edited at: 7th Mar 2006 19:49
Quote: "and move the boss left and right. Until it finished its half circle"

That was exactly what I wanted to know how to do

Me!
19
Years of Service
User Offline
Joined: 26th Jul 2005
Location:
Posted: 7th Mar 2006 20:37
you mean something like this?



it moves the cube around in an arc controled by the arrow keys, all you have to do inside the main loop is to place the cube in the center of the arc, turn it left or right by a small angle, then move it backwards the distance of the radius, then just keep doing this over and over, placing it in the middle, turning it a small amount and then moving back to the radius again, simple.



Windows: 32 bit extension/graphical shell for a 16bit patch to an 8bit OS originally coded for a 4bit CPU, written by a 2bit company that can't stand 1bit of competition, now available in 64bits.
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 7th Mar 2006 22:26
need a waypoint code?

[/center]
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 7th Mar 2006 23:08 Edited at: 7th Mar 2006 23:27
Just move it in a circle, but make the newXZvalues positive all the time, that should keep it moving in that fashion...

[edit]





UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 8th Mar 2006 23:27
Thanks for all the help, but the waypoint thing worked very well. I will use your help if I ever need to do this kind of thing again, which I am sure I will.

Thanks

General Sephiro
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location:
Posted: 9th Mar 2006 02:06 Edited at: 9th Mar 2006 02:06
Personally I like programming AI, very simple using different status's, usually makes the game seem more dynamic aswell

Hmm might make a small tutorial some time.

Login to post a reply

Server time is: 2025-05-23 09:08:01
Your offset time is: 2025-05-23 09:08:01