Search found 160 matches

by lotios611
Wed Jun 22, 2011 5:53 pm
Forum: Programming Discussion
Topic: Artificial Stupidity
Replies: 25
Views: 3026

Re: Artificial Stupidity

My problem (at least in my mind) has nothing to do with collision. I'm simple trying to get the AI's x and y to the gem's x and y.
by lotios611
Wed Jun 22, 2011 2:51 pm
Forum: Programming Discussion
Topic: Artificial Stupidity
Replies: 25
Views: 3026

Re: Artificial Stupidity

That's kind of what's happening. The AI checks to see if it's x pos is less than the gem's, and if it is, the AI moves 2 pixels right. The problem is, if for example the AI's x is 100, and the gem's x is 101, then the AI will move 2 pixels right, causing it's x pos to be greater than the gem's x pos...
by lotios611
Tue Jun 21, 2011 6:18 am
Forum: Programming Discussion
Topic: Artificial Stupidity
Replies: 25
Views: 3026

Re: Artificial Stupidity

I tried outputting the player's and the gem's coordinates, and it turn out it happens when the second player's x coord is less than two less than the gem's x coords.
by lotios611
Sun Jun 19, 2011 5:44 pm
Forum: Programming Discussion
Topic: Artificial Stupidity
Replies: 25
Views: 3026

Re: Artificial Stupidity

Alright, I've fixed it so that the AI no longer walks past the gem. However, it now gets stuck when the AI is to the left of the gem. Here's my code: if ((int)player2Pos.x < (int)gemPos.x) { player2Direction = RIGHT; player2Animating = true; player2.Move(3, 0); } else if ((int)player2Pos.x > (int)ge...
by lotios611
Sun Jun 19, 2011 7:58 am
Forum: Programming Discussion
Topic: New to gameprogramming but very exited to begin
Replies: 13
Views: 2144

Re: New to gameprogramming but very exited to begin

SDL is a nice library, but it is also a little restrictive in that you can only have 1 window at a time, and its normal drawing, compared to SFML (which is based on OpenGL), runs about as fast as an elephant with a broken knee. It does the job, but I can't say it's great. In SDL 1.3, pretty much al...
by lotios611
Sun May 29, 2011 4:10 pm
Forum: Programming Discussion
Topic: Artificial Stupidity
Replies: 25
Views: 3026

Re: Artificial Stupidity

That causes the player to walk past the gem. The x and y coords do correspond to the top left corner of both, and the width and height of both objects in greater than 5.
by lotios611
Sun May 29, 2011 7:20 am
Forum: Programming Discussion
Topic: Artificial Stupidity
Replies: 25
Views: 3026

Re: Artificial Stupidity

dandymcgee wrote:
lotios611 wrote:That change made the second player travel diagonally.
Toward the gem?
Yes, but I want the second player to travel in straight lines to the gem.
by lotios611
Sat May 28, 2011 6:15 pm
Forum: Programming Discussion
Topic: Artificial Stupidity
Replies: 25
Views: 3026

Re: Artificial Stupidity

That change made the second player travel diagonally. My project is all in main.cpp, which I've uploaded to pastebin here.
by lotios611
Sat May 28, 2011 1:26 pm
Forum: Programming Discussion
Topic: Artificial Stupidity
Replies: 25
Views: 3026

Re: Artificial Stupidity

It's still not working. Now it works when the gem is to the right or above the second player, but not when it is to the left of the player.

Edit: It turns out it works sometimes, but not other times...
by lotios611
Sat May 28, 2011 8:33 am
Forum: Programming Discussion
Topic: Artificial Stupidity
Replies: 25
Views: 3026

Artificial Stupidity

I'm working on a remake of Pickin' Sticks, and am trying to get some AI so that you can have a second player that is controlled by the computer. My problem is, the second player just walks right past the gem, going down. For example, say the gem spawns at 200, 200 and the second player spawns at 0, ...
by lotios611
Tue May 10, 2011 5:32 am
Forum: Game Development
Topic: [Question] Lua/C++ Balance, sequencing and Lua questions.
Replies: 7
Views: 3737

Re: [Question] Lua/C++ Balance, sequencing and Lua questions

I have no idea how to handle waiting until a key is pressed before returning to your Lua script without halting other things going on in your game, but I think you should handle the talk event in Lua so you can change what the entity says without having to recompile. That's pretty much the whole rea...
by lotios611
Thu Apr 07, 2011 6:09 pm
Forum: Programming Discussion
Topic: Simple C Error
Replies: 6
Views: 815

Re: Simple C Error

char *cmd = (char *)malloc(sizeof(char) * (strlen("gcc -std=c99 ") + strlen(fileName) + 1)); // The sizeof(char) may look a little redundant, but I have a habit of writing my C-style allocations to be ready to upgrade to wide characters with just a few project-wide find/replaces. sprintf(...
by lotios611
Thu Apr 07, 2011 5:46 pm
Forum: Programming Discussion
Topic: Simple C Error
Replies: 6
Views: 815

Re: Simple C Error

char *cmd = (char *)malloc(sizeof(char) * (strlen("gcc -std=c99 ") + strlen(fileName) + 1)); // The sizeof(char) may look a little redundant, but I have a habit of writing my C-style allocations to be ready to upgrade to wide characters with just a few project-wide find/replaces. sprintf(...
by lotios611
Wed Apr 06, 2011 5:08 pm
Forum: Programming Discussion
Topic: Simple C Error
Replies: 6
Views: 815

Re: Simple C Error

I am trying to code a brainfuck compiler thingy, and am almost done. However, I have ran into a problem. For some reason, the following code segfaults when ran. char* fileName = malloc((int)strlen(strcat(stripFileExtension(argv[1]), ".c")) * sizeof(char)); strcpy(fileName, strcat(stripFil...
by lotios611
Wed Apr 06, 2011 4:21 pm
Forum: Programming Discussion
Topic: Simple C Error
Replies: 6
Views: 815

Simple C Error

I am trying to code a brainfuck compiler thingy, and am almost done. However, I have ran into a problem. For some reason, the following code segfaults when ran. char* fileName = malloc((int)strlen(strcat(stripFileExtension(argv[1]), ".c")) * sizeof(char)); strcpy(fileName, strcat(stripFile...