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 with a repeat code...i'm sure the answer is simple

Author
Message
JM Studioz
20
Years of Service
User Offline
Joined: 14th Oct 2004
Location:
Posted: 30th Oct 2004 10:23
Can someone help me with this...Whenever i run it the screens jsut black...perhaps because of the repeat command? Heres the code:
JM Studioz
20
Years of Service
User Offline
Joined: 14th Oct 2004
Location:
Posted: 30th Oct 2004 16:57
Ok so now i've gotten it past the black screen...but it runs slow..and sometimes just stops. When I rotate the camera completely around,it just freezes...can someone plz help me?
This is what I got so far:
The Nerd
20
Years of Service
User Offline
Joined: 5th Jun 2004
Location: Denmark
Posted: 30th Oct 2004 23:44
try to put the sync rate in the start of the code.





The Nerd

FREE 2d collision toturials then visit my thread here : http://forum.thegamecreators.com/?m=forum_view&t=41045&b=5
my website : http://www.freewebs.com/waggames
JM Studioz
20
Years of Service
User Offline
Joined: 14th Oct 2004
Location:
Posted: 31st Oct 2004 01:05 Edited at: 31st Oct 2004 01:16
Nope..still doesn't fix my problem
I REALLY need help with this....otherwise i'm about to give up I know with some of you guys if this was a problem in one of your games you'd figure it out...Till then I guess i'll have to keep looking for something...
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 31st Oct 2004 01:03
The main problem is the 'repeat - until' loop. This part of the code is repeating a certain number of times, perhaps indefinitely, every single loop. Let the 'do' loop do the business of repeating the code, once every loop, and add an 'if - then' condition to prevent that part of the code executing when certain limits have been met.

This now executes properly, just by having taken out the repeat - until commands:


althoug without knowing what you are really trying to do, I'm not sure if it actually works how you intended.


JM Studioz
20
Years of Service
User Offline
Joined: 14th Oct 2004
Location:
Posted: 31st Oct 2004 01:14
Thanks! Yeah,i've already tried that...it semi-works. The mouse object doesn't stay exact with the mouse and screws around...so i'm trying to figure it out...hmmm
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 31st Oct 2004 04:03
I'm still trying to figure out what you're trying to do - you want to increase the distance between the camera and the object when the cursor is above it, and decrease the distance when it is below the object?

Just make sure that this is definitely the way you want to control you're movement before getting too deep into it, because I have a feeling it's going to get tricky!

(You're going to need to factor in the direction that the camera is pointing - it's not simply a case of moving the object along the x axis if you point to the left or right of it and moving along the z axis if you point above or below it, as it seems your code is trying to do. That would be fine if the camera always pointed in the positive z direction. But turn the camera into a different direction, and the whole axis of motion will need to change too.)


Just incase you were wondering, it isn't actually possible, by the way, to turn the x,y coordinates of your mouse cursor directly into an x,y,z coordinate in 3d space - whatever any else may say, it is mathematically NOT possible. There are ways around it, for example it is possible to turn x,y coordinates into x,z coordinates in the 3d plane if the missing y-dimension is already known, (eg. if you say that y=0 like you are in your code), but there is no algorithm which is going to turn x,y into x,y,z.


JM Studioz
20
Years of Service
User Offline
Joined: 14th Oct 2004
Location:
Posted: 31st Oct 2004 06:54
So how do i do it? I just want it simply like any point and click game's movement...obv they did something to get it to work...
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 31st Oct 2004 13:23 Edited at: 31st Oct 2004 13:24
I don't play games much so I don't know exactly how it works in the games you're talking about, but it's possible that there are 'locators' in 3-d space, like specific objects, which when clicked upon move the camera towards it. I think that would be a much easier way of going about it than what you've started.

pseudo code:

if object screen x (locator object)=mousex() and object screen y(locator object)=mousey

point camera (locator object position x,y,z)
move camera (speed)

endif


JM Studioz
20
Years of Service
User Offline
Joined: 14th Oct 2004
Location:
Posted: 1st Nov 2004 09:48
No matter where I go it seems theres no help...It looks like i'm just going have to give up my project and DB
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 1st Nov 2004 10:39
Quote: "It looks like i'm just going have to give up my project and DB "


You'll not get very far with that kind of ethos - you need perseverence in this game! And don't say you're not getting help just because you haven't got to the solution yet!


Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 1st Nov 2004 13:18
A far easier method would be to use advanced terrain instead of a matrix. Then you can make objects from each limb, hide them, and use the pick object command. Then tell object 2 to point to the object picked and move towards it. The other 3 methods I can think of are:
1. use the pick screen commands and try to figure out the distance from the camera to the point you click at
2. since you are using a matrix you can set up a grid to pick from. look at the code base for a matrix editor.
3. Some form of wicked 3d math we all have nightmares about.

Personally I would go with the terrain as the easiest. But if you are set on using a matrix then I would use option 1 or 2.

Login to post a reply

Server time is: 2024-11-27 15:33:45
Your offset time is: 2024-11-27 15:33:45