Well I've managed to bring it down to the point where corners like to mess up the player's position. Other than that, everything is fine.
I had that problem with mine for quite a while, never figured out how to solve it apart from rewriting large portions of code.
Another problem you might find is if your program does a lot of collisions at the same time. Can cause major slow down.
Maybe if I mess with the values depending on the side it's on, I could get it working.
And yeah, I think I might have problems with a lot of collisions. But I don't plan on making big worlds.
Can anybody help me with this?
[code]#include "Game.h"
#include <conio.h>
#include <iostream>
using namespace std;
bool Game::run(void)
{
//Recieve input, do x with input.
char key = ' ';
while (key != 'q');
(
while(!getInput (&key))
(
)
cout << "You pressed: " << key << endl
)
cout << "End of game" << endl;
return true;
}
bool Game::getInput(char *c)
{
if (kbhit())
(
*c = getch();
return true
)
return false;
}[/code]
Lines: 12
27
29
30
have syntax errors.
Well, first of all, you need to use curly braces { } for the blocks, instead of parentheses. You're also missing semicolons on two lines.
[QUOTE=shill le 2nd;26661867]Well, first of all, you need to use curly braces { } for the blocks, instead of parentheses. You're also missing semicolons on two lines.[/QUOTE]
Don't forget this.
[cpp]while (key != 'q');[/cpp]
which works exactly like
[cpp]while (key != 'q') {};[/cpp]
Thanks guys. I'm getting this from the 3DBuzz tutorials, and they're pretty dated.
Dear smart people, I need your help again.
Finally got bullets leaving the correct way from the boat, taking rotation into account, now if you watch the video below you will see that even after the bullets have been fired they are still taking rotation into account.
[media]http://www.youtube.com/watch?v=9N2jnM7p_nU[/media]
The reason it does this is because its updating the direction of the bullets to travel every update but its 4am I'm tired and I cannot think of a way around this. I need a way for bullets fired to stay on there set path and for new bullets to take rotation into account.
Here is the code for my bullet class;
[code]
#include "Bullet.h"
Bullet::Bullet(LPDIRECT3DDEVICE9 device, LPSTR pFilename, D3DXVECTOR3 newposition) : Object(device, pFilename, newposition)
{
Alive = false;
}
D3DXVECTOR3 Bullet::getVelocity(void) { return Velocity; }
void Bullet::setVelovity(float x, float y, float z)
{
Velocity = D3DXVECTOR3(x,y,z);
}
void Bullet::DrawBullet(float x,float y,float z)
{
Alive = true;
SetPosition(x,y,z);
}
void Bullet::Update(D3DXVECTOR3 rotation)
{
float XMove, ZMove;
if (Alive)
{
XMove = +(float)sin(rotation.x);
ZMove = +(float)cos(rotation.x);
Position = D3DXVECTOR3(Position.x + XMove, Position.y, Position.z + ZMove);
}
}
[/code]
All help appreciated :)
Edit: Would saving the position of the bullet when fired and then applying it only if the bullet has been fired be an option?
Edit: Problem sorted.
The video says "This is a private video..."
[QUOTE=yakahughes;26664066]The video says "This is a private video..."[/QUOTE]
Fixed.
I want a append! in my Scheme, however this fails for list with a length > 1:
[code](define (append! a b)
(if (null? (cdr a))
(set-cdr! a b)
(append! (cdr a) b)))
;; test it
(let ((a '(1 2))) (append! a '(3)))[/code]
output:
[code]error in set-cdr!: attempt to modify literal constant (2)
irritants:
((2) (3))
backtrace:
0 (set-cdr! a b)
1 (append! (cdr a) b)
2 (append! '(1 2) '(3))
[/code]
Clearly, looking at the backtrace, it's setting (cddr a) which is (), not 2. And anyways, it only sets the cdr if it is (), so what the hell?
Edit:
Fix'd.
Apparently '(1 2) creates an immutable pair. Bad error message though.
Right now I am trying to make a program that will copy a file from C :\Documents and Settings\{USER NAME}\Application Data\etc... from a (windows) computer, problem is if I don't write the exact user name in that file path it won't work. I do not have a way of knowing the user name in advance so my question is: is there a way for my program to get the user name and edit it into that filepath so that it'll work.
Thanks in advance.
tl;dr how do I get my program to edit the admin's username into itself.
[QUOTE=01271;26673389]tl;dr how do I get my program to edit the admin's username into itself.[/QUOTE]
[url]http://msdn.microsoft.com/en-us/library/ms724432(v=vs.85).aspx[/url]
How do I assign these buttons values? As in if one button is clicked, then you selected choice one, which therein goes to... Ect. Help?
[QUOTE=01271;26673389]Right now I am trying to make a program that will copy a file from C :\Documents and Settings\{USER NAME}\Application Data\etc... from a (windows) computer, problem is if I don't write the exact user name in that file path it won't work. I do not have a way of knowing the user name in advance so my question is: is there a way for my program to get the user name and edit it into that filepath so that it'll work.
Thanks in advance.
tl;dr how do I get my program to edit the admin's username into itself.[/QUOTE]
Just use %APPDATA% in the path - this redirects to the current user's Application Data Roaming directory.
[QUOTE=q3k;26673492][url]http://msdn.microsoft.com/en-us/library/ms724432(v=vs.85).aspx[/url][/QUOTE]
wasn't exactly what I needed but it helped me and put me on the right track anyways, thanks!
edit: ninja'd by met thank you also, I found that out.
Though, there are better ways of doing this depending on the language you're using.
[b]Edit:[/b] There goes that automerge! :v:
[QUOTE=Werem00se;26674760]How do I assign these buttons values? As in if one button is clicked, then you selected choice one, which therein goes to... Ect. Help?[/QUOTE]
In java.
[QUOTE=ZenX2;26636344]How would I compile [url=http://luaforge.net/projects/pluto/]this[/url] C library for Lua to a .dll with gcc?
I can't figure it out for the life of me, and google has been no help.[/QUOTE]
Anyone?
Edit : Don't you just hate it when you post a massive help post and then realise your error 10 seconds later.
[QUOTE=Jimmylaw;26685704]Edit : Don't you just hate it when you post a massive help post and then realise your error 10 seconds later.[/QUOTE]
Cardboard Programmer!
[code]The variable 'RadioVar' is assigned but its value is never used.[/code]
Then.
[code]The name 'RadioVar' does not exist in the current context[/code]
I am [B]BRAND[/B] new to C#, so I don't understand why this is happening. I am setting the variable string RadioVar = "On"
[QUOTE=vexx21322;26690087][code]The variable 'RadioVar' is assigned but its value is never used.[/code]
Then.
[code]The name 'RadioVar' does not exist in the current context[/code]
I am [B]BRAND[/B] new to C#, so I don't understand why this is happening. I am setting the variable string RadioVar = "On"[/QUOTE]
Can you post your code? Only reason I can think of is that you're declaring the variable outside the code you're using it in.
[QUOTE=raBBish;26690392]Yep, you're creating it in a different scope.
(Also, [noparse][csharp][/csharp][/noparse])
[csharp]private string _radioVar;
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
if ( radioButton1.Checked )
{
_radioVar = "ON";
}
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Text = _radioVar;
}[/csharp][/QUOTE]
Thank you.
And the problem is, I'm not a programmer yet.
I only know lua, python, and some other small scripting languages.
[editline]a[/editline]
Unless lua/python have scopes and I'm just not familiar with the name of the idea.
[QUOTE=vexx21322;26690443]Thank you.
And the problem is, I'm not a programmer yet.
I only know lua, python, and some other small scripting languages.[/QUOTE]
How humble of you, but I would still classify you as a programmer despite you not knowing any compiled languages, especially when you know Python. 1 Winner for lack of ego, a quality rare in the jungle of the internet, and much more valuable than any programming skill one might have.
[editline]14th December 2010[/editline]
And yes, Lua has scopes.
[editline]14th December 2010[/editline]
As well as python.
[QUOTE=yakahughes;26690589]How humble of you, but I would still classify you as a programmer despite you not knowing any compiled languages, especially when you know Python. 1 Winner for lack of ego, a quality rare in the jungle of the internet, and much more valuable than any programming skill one might have.
[editline]14th December 2010[/editline]
And yes, Lua has scopes.
[editline]14th December 2010[/editline]
As well as python.[/QUOTE]
Then I think I know what scopes are, just never heard of it by name.
Anyone know if its possible to create a light that rotates using directx?
Here is my light code;
[code]
#include "Point.h"
Point::Point(LPDIRECT3DDEVICE9 device,D3DXCOLOR diffuse,D3DXVECTOR3 position, float range) : Light(device)
{
Diffuse = diffuse;
Position = position;
Range = range;
}
void Point::Draw(int number)
{
light.Type = D3DLIGHT_POINT; // make the light type 'point light'
light.Diffuse = Diffuse;
light.Position = Position;
light.Range = Range;
light.Attenuation0 = 0.0f; // no constant inverse attenuation
light.Attenuation1 = 0.125f; // only .125 inverse attenuation
light.Attenuation2 = 0.0f; // no square inverse attenuation
d3ddev->SetLight(number, &light);
d3ddev->LightEnable(number, TRUE);
}
[/code]
[QUOTE=Werem00se;26676162]In java.[/QUOTE]
I fixed it, thanks for the help guys. :fuckyou:
Sorry, you need to Log In to post a reply to this thread.