[QUOTE=NixNax123;46388871]No.[/QUOTE]
I suspect it's part of your input handling code then. Can you show me the code where you actually read in the keyboard buttons?
[QUOTE=Tommyx50;46388887]I suspect it's part of your input handling code then. Can you show me the code where you actually read in the keyboard buttons?[/QUOTE]
That's a problem with SFML, I think.
Here's my github with the project (each input key/mouse button is assigned an action)
[url]https://github.com/Tetramputechture/Corraticca/[/url]
[editline]1st November 2014[/editline]
in hindsight i probably should've used Slick2D but i'm stupid and still can't plan a project
fuck me
[QUOTE=NixNax123;46388919]That's a problem with SFML, I think.
Here's my github with the project (each input key/mouse button is assigned an action)
[url]https://github.com/Tetramputechture/Corraticca/[/url]
[editline]1st November 2014[/editline]
in hindsight i probably should've used Slick2D but i'm stupid and still can't plan a project
fuck me[/QUOTE]
Whoa seriously man calm down! SFML is a good library from what I've heard, you can probably achieve what you want.
I'm just taking a wee while reading through your code and checking up on JSFML documentation. You've achieved a decent amount, don't stumble on a tiny hurdle :)
EDIT:
Did you ever have the game correctly taking all 8 directions into account? Or has it always only managed 4?
EDIT:
Anyways, I'm feeling a bit sleepy. I'll be back tomorrow - good luck with your project.
The input handle just manages all cardinal directions. I couldn't implement two keypresses at once to do a diagonal, and that would also be messy. I don't understand, it worked perfectly before, I could move anywhere and the movement was slick, but I didn't have friction. Now, I have friction, but the movement isn't really how I want it to be. Thanks for looking at my code, man! You're awesome. This is my first big project and I really don't want this to be what stops me.
[QUOTE=NixNax123;46389108]The input handle just manages all cardinal directions. I couldn't implement two keypresses at once to do a diagonal, and that would also be messy. I don't understand, it worked perfectly before, I could move anywhere and the movement was slick, but I didn't have friction. Now, I have friction, but the movement isn't really how I want it to be. Thanks for looking at my code, man! You're awesome. This is my first big project and I really don't want this to be what stops me.[/QUOTE]
No problem - I find explaining this stuff and programming in general very fun (mostly because it gives me an excuse to ignore my own projects! :v:)
The issue isn't with needing to grab 2 keypresses, I think. As far as I can tell, SFML sends an event queue (which you loop through in Window.java) and for each event you check if it's a keypress. If so, you handle the key input in Input.java and then call the various events, such as move up / move down.
So, in theory, if you hold both the W and D keys, 2 events would be generated, and both would be looped through and have their appropriate functions called, which should set targetY to -1 and targetX to 1. I don't understand why this part isn't working, but I'm sleepy.
After all, you can shoot while moving, so the issue doesn't appear to be with handling the various events... I'm not exactly sure what the issue is, but I'll check more tomorrow.
You say the movement isn't exactly how you want it - what is the issue, exactly? Is it just the diagonals, or is the other stuff too?
[QUOTE=Tommyx50;46389176]
You say the movement isn't exactly how you want it - what is the issue, exactly? Is it just the diagonals, or is the other stuff too?[/QUOTE]
Well, like I posted:
[vid]http://a.pomf.se/hbzhun.webm[/vid]
Is how I want it, but with that implementation I can't have friction.
I feel like if the diagonals are fixed then I would get really nice, easy to handle movement.
This is using libGDX, but at least part of it can apply to normal Bullet as well. When using a mesh to create my static collision shape (it isn't practical to use primitive shapes or a convex hull for my level geometry), I come across two different errors depending on how I create it.
First, if I use the following method with obtainStaticNodeShape:
[code]collisionShape = Bullet.obtainStaticNodeShape(modelInst.nodes);
collisionMotion = new btDefaultMotionState(modelInst.transform);
collisionBody = new btRigidBody(mass, collisionMotion, collisionShape);[/code]
[img]http://i.imgur.com/GspiAF3.png[/img]
(apologies for the lack of optimization at this point)
The collision shape fits the model perfectly. However, when I drop a btSphereShape (the golf ball, of course) on it, the ball simply passes through.
When I use this other method with btTriangleIndexVertexArray:
[code]btTriangleIndexVertexArray collisionMesh = new btTriangleIndexVertexArray(modelInst.model.meshParts);
collisionShape = new btBvhTriangleMeshShape(collisionMesh, true);
collisionMotion = new btDefaultMotionState(modelInst.transform);
collisionBody = new btRigidBody(mass, collisionMotion, collisionShape);[/code]
[img]http://i.imgur.com/uUc7y6q.png[/img]
The sphere will correctly react to the course's collision shape. However, as you can see, the collisionShape is misaligned and misscaled from the visual model.
What am I doing incorrectly? Preferably, I'd like to know how to correct both errors.
Does anyone know a good C compiler?
I have miniGW. but its a bit problematic.
[QUOTE=NixNax123;46389263]Well, like I posted:
Is how I want it, but with that implementation I can't have friction.
I feel like if the diagonals are fixed then I would get really nice, easy to handle movement.[/QUOTE]
It's hard to judge from a video, but I think you could get similar to that by just tweaking the accelRate variable.
Edit:
Oh right, you mean that the lack of diagonals are the issue. I'm trying to run the source to be able to debug it - what IDE and libraries are you using?
I'm looking to start a book collection and I got enough money in the bank for 2 books right now. As a C# beginner, I'd like a book with good technical information and a best practices book.
Even though the Internet exists, it is often not as in-depth as books can be. Here are the books I'm looking at, so which of these two books should I buy?
[url=http://www.amazon.com/5-0-Nutshell-The-Definitive-Reference/dp/1449320104/ref=pd_bxgy_b_img_y]C# 5.0 in a Nutshell[/url]
[url=http://www.amazon.com/gp/product/161729134X/ref=s9_simh_gw_p14_d0_i7?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-2&pf_rd_r=19MWQC2JANN8YSAQVCJ4&pf_rd_t=101&pf_rd_p=1688200382&pf_rd_i=507846]C# in Depth[/url]
[url=http://www.amazon.com/CLR-via-4th-Developer-Reference/dp/0735667454/ref=sr_1_1?s=books&ie=UTF8&qid=1414933347&sr=1-1&keywords=clr+via+c%23]CLR via C#[/url]
[url=http://www.amazon.com/Effective-Covers-4-0-Specific-Development/dp/0321658701#reader_0321658701]Effective C#[/url]
[QUOTE=elevate;46390869]I'm looking to start a book collection and I got enough money in the bank for 2 books right now. As a C# beginner, I'd like a book with good technical information and a best practices book.
Even though the Internet exists, it is often not as in-depth as books can be. Here are the books I'm looking at, so which of these two books should I buy?
[url=http://www.amazon.com/5-0-Nutshell-The-Definitive-Reference/dp/1449320104/ref=pd_bxgy_b_img_y]C# 5.0 in a Nutshell[/url]
[url=http://www.amazon.com/gp/product/161729134X/ref=s9_simh_gw_p14_d0_i7?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-2&pf_rd_r=19MWQC2JANN8YSAQVCJ4&pf_rd_t=101&pf_rd_p=1688200382&pf_rd_i=507846]C# in Depth[/url]
[url=http://www.amazon.com/CLR-via-4th-Developer-Reference/dp/0735667454/ref=sr_1_1?s=books&ie=UTF8&qid=1414933347&sr=1-1&keywords=clr+via+c%23]CLR via C#[/url]
[url=http://www.amazon.com/Effective-Covers-4-0-Specific-Development/dp/0321658701#reader_0321658701]Effective C#[/url][/QUOTE]
Honestly the best option really is the internet. It has absolutely everything you need when it comes to what you want to code and it isn't linear like a book, but if you really want a book I suggest going to your local bookstore first just to see if they have any books on C# so you don't have to end up waiting a few days for your book to arrive from mail when its already available near you.
[QUOTE=Tommyx50;46390815]It's hard to judge from a video, but I think you could get similar to that by just tweaking the accelRate variable.
Edit:
Oh right, you mean that the lack of diagonals are the issue. I'm trying to run the source to be able to debug it - what IDE and libraries are you using?[/QUOTE]
I've updated my GitHub page with dependencies and the like.
[editline]2nd November 2014[/editline]
[url]https://github.com/Tetramputechture/Corraticca/[/url]
Also, I'm using NetBeans.
The only reason you can move when holding down a key is because the key repeat is on.
And key repeat does not work with more than one button at a time, try it in any text field.
[QUOTE=WeltEnSTurm;46387559]You still don't handle key releases, try my first two lines and remove the four input handlers.[/QUOTE]
[QUOTE=WeltEnSTurm;46387335][code]
targetX = (isKeyPressed(Key.A) ? -1 : 0) + (isKeyPressed(Key.D) ? 1 : 0);
targetY = (isKeyPressed(Key.S) ? -1 : 0) + (isKeyPressed(Key.W) ? 1 : 0);
[/code]
[/QUOTE]
I'm starting to write my own application suite (for fun and for skyrocketing my programming experience), and I'm starting with the GUI framework since I want to try and make the programs cross platform. Currently I'm using windows for the initial programs because it's the most easily available platform for me right now. I want the applications to have themes applicable to the program rather than sticking do platform default boxes, buttons, etc.
For windows I've found a section on custom drawing in MSDN, but the process is a bit confusing. Would it be easier to just use the window's device context and draw the controls themselves on it, or to stick with MSDN's way of doing it? For example, the base progress bar would draw an unfilled rectangle (using GDI/GDI+), then draw a flooded rectangle inside with the size depending on the progress.
[QUOTE=WeltEnSTurm;46392466]The only reason you can move when holding down a key is because the key repeat is on.
And key repeat does not work with more than one button at a time, try it in any text field.[/QUOTE]
That works beautifully, and I love you (I know I should've listened to you a long time ago about this), but could you be so kind as to help me work that in with my current implementation, so I don't have to hardcode it in? I still want to keep the functionality I have with the Input class, and changing keys, etc.
[url]https://github.com/Tetramputechture/Corraticca/[/url]
edit:
I can't seem to get it to work, I'll just sacrifice that key changing functionality.
[QUOTE=ADSmaster724;46390573]Does anyone know a good C compiler?
I have miniGW. but its a bit problematic.[/QUOTE]
Are you talking Windows-specific compilers, or good C compilers?
If it's the former, I'd say your best bet is MinGW, but with a good IDE it can work pretty well.
[QUOTE=NixNax123;46392690]That works beautifully, and I love you (I know I should've listened to you a long time ago about this), but could you be so kind as to help me work that in with my current implementation, so I don't have to hardcode it in? I still want to keep the functionality I have with the Input class, and changing keys, etc.
[url]https://github.com/Tetramputechture/Corraticca/[/url]
edit:
I can't seem to get it to work, I'll just sacrifice that key changing functionality.[/QUOTE]
Since your current input system doesn't support key releases you'd have to create your own.
Save the keyboard state, and check each update for changed keys.
If you keep it like this you can still have input changing, you just have to somehow get access to the key mapping in the player entity.
I'm trying to do Coderbyte challenges to learn some Java before the programming course starts but it doesn't work for some reason. Is this just me or is there something wrong with the site?
[QUOTE=MistyVermin;46392067]Honestly the best option really is the internet. It has absolutely everything you need when it comes to what you want to code and it isn't linear like a book, but if you really want a book I suggest going to your local bookstore first just to see if they have any books on C# so you don't have to end up waiting a few days for your book to arrive from mail when its already available near you.[/QUOTE]
Depends on the book really. There are some great C# books out there which I think are better than any guide online.
[QUOTE=elevate;46390869]I'm looking to start a book collection and I got enough money in the bank for 2 books right now. As a C# beginner, I'd like a book with good technical information and a best practices book.
Even though the Internet exists, it is often not as in-depth as books can be. Here are the books I'm looking at, so which of these two books should I buy?[/QUOTE]
I'd recommend Head First C# (if you're absolute beginner) and C# 5.0 in a Nutshell. The latter is excellent at teaching about all aspects of C#.
[QUOTE=elevate;46390869]I'm looking to start a book collection and I got enough money in the bank for 2 books right now. As a C# beginner, I'd like a book with good technical information and a best practices book.
Even though the Internet exists, it is often not as in-depth as books can be. Here are the books I'm looking at, so which of these two books should I buy?
[url=http://www.amazon.com/5-0-Nutshell-The-Definitive-Reference/dp/1449320104/ref=pd_bxgy_b_img_y]C# 5.0 in a Nutshell[/url]
[url=http://www.amazon.com/gp/product/161729134X/ref=s9_simh_gw_p14_d0_i7?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-2&pf_rd_r=19MWQC2JANN8YSAQVCJ4&pf_rd_t=101&pf_rd_p=1688200382&pf_rd_i=507846]C# in Depth[/url]
[url=http://www.amazon.com/CLR-via-4th-Developer-Reference/dp/0735667454/ref=sr_1_1?s=books&ie=UTF8&qid=1414933347&sr=1-1&keywords=clr+via+c%23]CLR via C#[/url]
[url=http://www.amazon.com/Effective-Covers-4-0-Specific-Development/dp/0321658701#reader_0321658701]Effective C#[/url][/QUOTE]
I used [URL="http://www.apress.com/9781430242338"]Pro C# 5.0 and .Net framework 4.5[/URL].
In my CS courses my school used [URL="http://shop.oreilly.com/product/0636920000679.do"]Head First C#[/URL], this book is more beginner stuff and doesn't do more advanced topics like Pro C# 5.0.
Am I doing something wrong or is this not a good way to solve it? [url]https://projecteuler.net/problem=15[/url]
[code]public class PrEu15 {
public static void main(String[] args) {
int size = 20;
int sum = PathCount(0,0,size);
System.out.println(sum);
}
static int PathCount(int x, int y, int size) {
int count = 0;
if (x == size && y == size) {
return 1;
}
else {
if (x + 1 <= size) {
count += PathCount(x + 1, y, size);
}
if (y + 1 <= size) {
count += PathCount(x, y + 1, size);
}
}
return count;
}
}[/code]
[editline]3rd November 2014[/editline]
Okay, I checked some lower numbers for size so I guess it's just not effective.
[QUOTE=Tommyx50;46387779]
Before, what you were doing was declaring the variable in one file (but not defining it), meaning that it both couldn't be seen by the file with main() and the memory was never actually allocated for it.
In the code I show, I use extern to declare the int a (meaning the compiler creates the variable "token", but doesn't allocate any memory) and then actually defining (and thus having the memory allocated) in the second file.[/QUOTE]
So what if I want to define a in the other file? I tried putting
[code]int a =22;[/code]
and the other was:
[code]#include <stdio.h>
int main(){
extern int a;
printf("%d",a);
return 0;
}[/code]
and I got an undefined reference to a error. Is there any way to define a in another file?
You've created the variable a but it has not been allocated in memory, then you're trying to change the value of a to 22 but that is not possible because a doesn't actually exist in memory yet, try setting a=0 in your main function so it's got somewhere to put the 22
[QUOTE=Kondor;46399327]You've created the variable a but it has not been allocated in memory, then you're trying to change the value of a to 22 but that is not possible because a doesn't actually exist in memory yet, try setting a=0 in your main function so it's got somewhere to put the 22[/QUOTE]
what if I wanted to get the value of a from one file and use it in another?
In that case define a in a header file and include it in any files that need to use a, declare it in one of the files and then any file that changes the value of a will change it for all the files using a
[editline]3rd November 2014[/editline]
your header should look like this to avoid it being defined multiple times too
#ifndef HEADER_FILE
#define HEADER_FILE
extern int a;
#endif
How would I do something every specified time interval in Java?
Such as:
[code] @Override
public void show() {
...
if (numEnemies <= maxEnemies) {
// spawn enemy every 3 seconds
}
...
}[/code]
you could use the system clock or use duration
[url]http://docs.oracle.com/javase/8/docs/api/java/time/Duration.html[/url]
Also, how could I get that to perform with the show() method, which performs every frame?
[editline]3rd November 2014[/editline]
I guess I'll have to make a wave class! Time to do that.
[QUOTE=NixNax123;46399748]How would I do something every specified time interval in Java?
Such as:
[code] @Override
public void show() {
...
if (numEnemies <= maxEnemies) {
// spawn enemy every 3 seconds
}
...
}[/code][/QUOTE]
uhh, [code]if(SYSTEM_TIME % 3) = 0[/code] maybe?
Once a time variable reaches the time you have to wait before something happens you do the thing and reset it. That's at least how I'd do it.
Sorry, you need to Log In to post a reply to this thread.