[QUOTE=Staneh;31687422]Okay, I got this atm:
[cpp] this.bullets.AddLast(new Bullet(velocity, new Vector2(tanktop.Width / 2 + tanktop.Width / 2 - 75 * (float) Math.Cos(ttangle), tanktop.Height / 2 + tanktop.Width / 2 - 75 * (float) Math.Sin(ttangle)), 10.0f, ttangle));[/cpp]
Now, this code shoots bullets everywhere and nowhere, there is something wrong[/QUOTE]
Try this
[cpp] this.bullets.AddLast(
new Bullet(velocity,
new Vector2((tanktop.X + tanktop.Width / 2) + 75* * (float) Math.Cos(ttangle),
(tanktop.Y + tanktop.Height / 2) + 75* * (float) Math.Sin(ttangle)),
10.0f,
ttangle));[/cpp]
Also try converting your angle in radians or degrees, can't remember what Math.Sin/Cos uses.
Sweet my little framework is slowly coming together, yesterday I managed to get all the window creation crap into one class, today im setting up creating the window with WindowSettings, will essentially look like this(well it currently does)
[cpp]WindowSettings settings;
settings.setWindowResolution(ScreenResolutions::r1280x768);
Window window(settings, "Test Window");
while(window.isWindowOpen());
[/cpp]
How did you limit the framerate? I remember it was something like
[code]
if(updateTime < requestedUpdateTime)
sleep(requestedUpdateTime - updateTime);
[/code]
[QUOTE=SupahVee;31687734]Try this
[cpp] this.bullets.AddLast(
new Bullet(velocity,
new Vector2((tanktop.X + tanktop.Width / 2) + 75* * (float) Math.Cos(ttangle),
(tanktop.Y + tanktop.Height / 2) + 75* * (float) Math.Sin(ttangle)),
10.0f,
ttangle));[/cpp]
Also try converting your angle in radians or degrees, can't remember what Math.Sin/Cos uses.[/QUOTE]
Still won't work, it still shoots out bullets everywhere but my tank-loop..
[QUOTE=Richy19;31687796]Sweet my little framework is slowly coming together, yesterday I managed to get all the window creation crap into one class, today im setting up creating the window with WindowSettings, will essentially look like this(well it currently does)
[cpp]WindowSettings settings;
settings.setWindowResolution(ScreenResolutions::r1280x768);
Window window(settings, "Test Window");
while(window.isWindowOpen());
[/cpp]
How did you limit the framerate? I remember it was something like
[code]
if(updateTime < requestedUpdateTime)
sleep(requestedUpdateTime - updateTime);
[/code][/QUOTE]
Instead of having functions to set the resolution, why not just making WindowSettings a POD type and access the members directly;
[cpp]WindowSettings settings;
settings.Width = 1280;
settings.Height = 800;
settings.Bpp = 24;[/cpp]
[QUOTE=Staneh;31687898]Still won't work, it still shoots out bullets everywhere but my tank-loop..[/QUOTE]
What coordinate system do you use, e.g. where is the origin and in what directions is positive?
[QUOTE=Chris220;31687908]Instead of having functions to set the resolution, why not just making WindowSettings a POD type and access the members directly;
[cpp]WindowSettings settings;
settings.Width = 1280;
settings.Height = 800;
settings.Bpp = 24;[/cpp][/QUOTE]
Because of how I plan on designing the game, i preffer to have set resolutions (makes planning all the different sizes easier) I will have a setWH() method to override the width height but for now I dont need so many resolutions
Okay, i'll just post some code
Here is the code when the mouse is pressed:
[cpp] if (newState.LeftButton == ButtonState.Pressed && oldState.LeftButton == ButtonState.Released)
{
drawBullet = true;
// todo: get tip of turrent by x/y normal vector of rotation (simply y) * length
float ttx = (float)70 + tanktop.Width;
float tty = (float)90;
ttangle = (float)Math.Atan2((tty + ty) - Mouse.GetState().Y, (ttx + tx) - Mouse.GetState().X);
ttx = (float)tanktop.Width - 35;
tty = (float)tanktop.Height / 2 - 45;
float rttx = ttx * (float)Math.Cos(ttangle) - tty * (float)Math.Sin(ttangle);
float rtty = ttx * (float)Math.Sin(ttangle) + tty * (float)Math.Cos(ttangle);
Vector2 velocity = new Vector2((float)Math.Cos(ttangle) * 4, (float)Math.Sin(ttangle) * 4);
this.bullets.AddLast(new Bullet(velocity, new Vector2((ttx + tanktop.Width / 2) + 75 * (float)Math.Cos(ttangle), (tty + tanktop.Height / 2) + 75 * (float)Math.Sin(ttangle)), 10.0f, ttangle));
MediaPlayer.Play(boom);
}[/cpp]
Drawing the bullets:
[cpp] if(drawBullet)
{
foreach( Bullet b in bullets )
{
spriteBatch.Draw(bullet, b.Position, null, Color.White, b.Direction - (float)MathHelper.ToRadians(90), new Vector2(10.0f, 20.0f), 1.0f, SpriteEffects.None, 0);
}
}[/cpp]
And, bullet.cs
[cpp] public class Bullet
{
public Vector2 Velocity, Position;
public float Life, Direction;
public Bullet(Vector2 Velocity, Vector2 Position, float Lifetime, float Direction)
{
this.Velocity = Velocity;
this.Position = Position;
this.Life = Lifetime;
this.Direction = Direction;
}
public void Update(GameTime gameTime)
{
this.Life -= gameTime.ElapsedGameTime.Milliseconds * 0.001f;
this.Position += this.Velocity;
}
}[/cpp]
[QUOTE=Richy19;31687974]Because of how I plan on designing the game, i preffer to have set resolutions (makes planning all the different sizes easier) I will have a setWH() method to override the width height but for now I dont need so many resolutions[/QUOTE]
Well you could still do it like this:
[cpp]settings.Resolution = whateverYourEnumIsCalled;[/cpp]
I dunno, maybe it's just personal preference; I feel setting such trivial things using functions is kinda redundant. Either way works so go with whatever :v:
[QUOTE=Chris220;31688056]Well you could still do it like this:
[cpp]settings.Resolution = whateverYourEnumIsCalled;[/cpp]
I dunno, maybe it's just personal preference; I feel setting such trivial things using functions is kinda redundant. Either way works so go with whatever :v:[/QUOTE]
I could but i have a width and height int which is what is used by the window class, and when using set resolution, these ints get set to the correct size.
If I used your method then I would have to do all those checks in the window class
Hey guys, sorry to bother you but I have a small favour to ask of you.
I need a small program/script that can find the amount of files in a folder, copy all of their names minus file extensions, and then make a certain number of copies of a different file, the number of copies being equal to the number of files found in the folder.
For example:
I have 1 file named SAV.srm and 4 different files.
Mario.rom
Kirby.rom
Earthwormjim.rom
Yoshi.rom
What I need the program to do, as stated previously, is find these .rom files, copy the names and then make 4 copies of SAV.srm and rename all the copies of SAV.srm after the .rom files so we end up with this in the folder:
Mario.rom
Kirby.rom
Earthwormjim.rom
Yoshi.rom
Mario.srm
Kirby.srm
Earthwormjim.srm
Yoshi.srm
If anyone can help me with this that would be awesome.
[QUOTE=Nekrietns;31688224]Hey guys, sorry to bother you but I have a small favour to ask of you.
I need a small program/script that can find the amount of files in a folder, copy all of their names minus file extensions, and then make a certain number of copies of a different file, the number of copies being equal to the number of files found in the folder.[/QUOTE]
place SAV.srm and all rom files into C:\test\ (having other files is okay too, it'll only use the rom files)
run [url]http://filesmelt.com/dl/copyshitandstuff1.zip[/url]
Or run from source with Autoit3.
[code]#include <file.au3>
$filearray = _filelisttoarray("C:\test\", "*", 1)
for $i = 1 to UBound ( $filearray ) - 1
$string = $filearray[$i]
if stringmid($string, stringlen($string)-2, 3) = "rom" Then
$out = "C:\test\" & stringmid($string, 1, stringlen($string)-4) & ".srm"
consolewrite(@LF & $out)
$test = filecopy( "C:\test\SAV.srm", $out)
consolewrite(@LF & $test)
endif
next[/code]
Coding in a language you haven't used in 1-2 years is painful.
Edit: Updated to make .rom case insensitive..
Holy fuck thanks a ton!
I made a mistake in rom format, but I fixed that real quick.
[QUOTE=Chris220;31688056]Well you could still do it like this:
[cpp]settings.Resolution = whateverYourEnumIsCalled;[/cpp]
I dunno, maybe it's just personal preference; I feel setting such trivial things using functions is kinda redundant. Either way works so go with whatever :v:[/QUOTE]
When I read that my mouse was over the E of Enum so I read it as
[cpp]settings.Resolution = whateverYourMumIsCalled;[/cpp]
Err... 1440*900?
Oh look, I've built myself a dirt house :O
[IMG]http://img215.imageshack.us/img215/8867/minecraftclone201108121.png[/IMG]
[QUOTE=thf;31685264]Just read a bit at open.gl, and I just have to say, this is a [b]really[/b] messy type name:
[code]PFNWGLCREATECONTEXTATTRIBSARBPROC[/code][/QUOTE]
It's easy to remember though because it always starts with PFNWGL and ends with ARBPROC. All you need to remember is the function name you want which goes in the middle.
[QUOTE=s0ul0r;31689541]Oh look, I've built myself a dirt house :O
[/QUOTE]What are the dimensions of your world?
Also for Open.GL Chapter 2 source code, shouldn't there be a UnregisterClass("Dummy", instance) in the part where we destroy it since we aren't using that class again?
[editline]12th August 2011[/editline]
Broke my auto merge :(
[QUOTE=awfa3;31689705]It's easy to remember though because it always starts with PFNWGL and ends with ARBPROC. All you need to remember is the function name you want which goes in the middle.[/QUOTE]
It always ends with PROC. I believe ARB might be exchanged for something else when using non-ARB extensions.
[QUOTE=danharibo;31689758]What are the dimensions of your world?[/QUOTE]
Same as mc, 16x16 chunks, each chunk being 16x128x16, that's what you see on the screen there
Oh, I just noticed mc uses 16 chunks in each direction, so I changed mine to 32x32:
[IMG]http://img651.imageshack.us/img651/8867/minecraftclone201108121.png[/IMG]
I'll make a thread about open.gl to stop the derailing.
I don't see any derailing here, sir.
[QUOTE=Overv;31690156]I'll make a thread about open.gl to stop the derailing.[/QUOTE]
No, you'll carry on posting in here and you'll enjoy it :v:
[QUOTE=NovembrDobby;31690262]No, you'll carry on posting in here and you'll enjoy it :v:[/QUOTE]
I'll keep posting about my progress here, but it's easier to ask for help or post about mistakes in a thread about it.
[QUOTE=Overv;31690297]I'll keep posting about my progress here, but it's easier to ask for help or post about mistakes in a thread about it.[/QUOTE]Well, this is the "What are you working on?" thread, and open.gl is what you are working on...
[QUOTE=Neo Kabuto;31690330]Well, this is the "What are you working on?" thread, and open.gl is what you are working on...[/QUOTE]
That's why I'll keep posting about progress here, but not suggestions and error reports.
Now that's interesting! That OpenGL viewer stated I have openGL version 4.1, even though my graphics card vendor says I have openGL 3.2 support, would this be because of newer drivers?
Sorry in advance.
Has anyone else found that - even with a good deal of programming experience - moving onto web development isn't very straightforward at all? I've been knobbing around with HTML and CSS for the last few days, but there doesn't seem to be any clear learning paths towards creating a fully functioning website. Do I get back into Python or learn PHP? How do I use SQL and when? What do I need to set up a webserver without opening myself up to attack?
Again, sorry for posting irrelevant bullshit, but this section moves a lot faster and you guys are always really helpful. :3
For Open.GL, if any of you have the bug where your cursor is weird, (Like you move your mouse to the edge so it becomes the <-> but when you move it back onto the program's main screen, it's still <->) just put [cpp]windowClass.hCursor = LoadCursor(0, IDC_ARROW);[/cpp] where you are defining the window class.
[QUOTE=awfa3;31692138]For Open.GL, if any of you have the bug where your cursor is weird, (Like you move your mouse to the edge so it becomes the <-> but when you move it back onto the program's main screen, it's still <->) just put [cpp]windowClass.hCursor = LoadCursor(0, IDC_ARROW);[/cpp] where you are defining the window class.[/QUOTE]
Thanks, added that. I'm currently working on the Linux code.
[t]http://i.imgur.com/9tDpf.jpg[/t]
[QUOTE=Overv;31692267]Thanks, added that. I'm currently working on the Linux code.
[t]http://i.imgur.com/9tDpf.jpg[/t][/QUOTE]
Indeed you are.
Sorry, you need to Log In to post a reply to this thread.