[QUOTE=Richy19;30705425]blah = new Array[6,2]{
{1,1},
{1,1},
{1,1},
{1,1},
{1,1},
{1,1}
}
I think[/QUOTE]
Not really easier then the current way I'm doing it really. I just wanted a system where I could put in what each cell was equal too and it would know what row/collum i was meaning.
[QUOTE=Jimmylaw;30705576]Not really easier then the current way I'm doing it really. I just wanted a system where I could put in what each cell was equal too and it would know what row/collum i was meaning.[/QUOTE]
Can you write up what you want in pseudocode? I don't really understand what you're asking for here.
[editline]25th June 2011[/editline]
[QUOTE=Ehmmett;30705868]-snip-[/QUOTE]
I don't really know LOVE, but it seems you use a sprite batch for drawing stuff, so take a look at that:
[url]http://love2d.org/wiki/SpriteBatch:add[/url]
[QUOTE=Jimmylaw;30705576]Not really easier then the current way I'm doing it really. I just wanted a system where I could put in what each cell was equal too and it would know what row/collum i was meaning.[/QUOTE]
some pseudocode because I'm lazy:
[code]
for (columns you want set)
for (rows you want set)
array[column, row] = value;
[/code]
[QUOTE=Chris220;30706816]Can you write up what you want in pseudocode? I don't really understand what you're asking for here.[/QUOTE]
I believe he wants to do:
blah = new Array[6,2]{1,2,3,4,5,6,1,3,5,7,9,11}
and have it automatically put it as
blah = new Array[6,2]{
{1,2},
{3,4},
{5,6},
{1,3},
{5,7},
{9,11}
}
Which I doubt you can do.
Your only other options are to make an algorith that does it for you (hard, I dont recomend)
Or use a 1 dimension array and just do it like
array[Width*height]{1,2,3,4,5,6,1,3,5,7,9,11}
and then to get it you do
aray[widthX + (heightY * arrayWidth)]
[editline]25th June 2011[/editline]
[QUOTE=robmaister12;30706958]some pseudocode because I'm lazy:
[code]
for (columns you want set)
for (rows you want set)
array[column, row] = value;
[/code][/QUOTE]
Not all values in the array are going to have the same value
[QUOTE=Ehmmett;30704048]Trying out this Lua LOVE stuff. (First venture into Lua at all :v: )
Is there a way I can just run it or like auto convert it or something?
It's becoming tedious to have to compress it, rename it, run it, find it doesn't work, try to fix, rinse repeat.[/QUOTE]
Yeah. In the folder where you have your folder containing your main.lua, make a shortcut to LÖVE.
To launch your game, drag the folder onto the shortcut.
Also, you may want to ask LÖVE questions on the [url=http://love2d.org/forums/]LÖVE forums[/url] if you want quicker answers.
[QUOTE=Richy19;30707012]
[editline]25th June 2011[/editline]
Not all values in the array are going to have the same value[/QUOTE]
you don't have to set column or row to the lengths, if you only wanted columns 2 and 3, you would set that as "for (i = 2; i <= 3; i++)"
I'm realizing this was stupid enough to not need its own thread...
I wrote a .bat file that mounts all my games into my gmod config
(tf2 updates make me have to update it all the time >:|)
and yet, if gmod launches, it un-mounts everything to make sure it mounts the newest content or something...
So, i need to have the bat file check if hl2.exe (or preferably a window titled "garrys mod") gets launched, and when it CLOSES, run a command, i found a way to hook it on startup, but not on any other terms.
it also has to be loop-able so I can not worry about re-setting it every time, or i would just run the batch file every time i finish testing.
Obviously it can't be checking for a missing process from the get-go, or constantly check, or it would be re-mounting every loop, and with the mount taking 10 seconds, yeah, not a good idea unless I want to go to lag hell.
overall, i suck at BATCH, I like almost any language over it (except the C's) but it was the simplest to write my mounter in. Only 2 lines compared to the 10 in VB, but hey, I'm open to anything
wow, this is bad, I'm thinking how easy it would be to do in redstone, just a latch that resets once it comes back in a loop....
sorry for starting a new topic, i thought it would be better for organization, but it ended up being a mess...
Okay... This is embarrasing.
After struggling with C++ for a while, being forced to take a break due to school stuff and forget everything, I today decided to take up programming again. But I needed repetition, so I thought I'd restart with Java.
Naturally, a Hello World program comes first:
class test{
public static void main(string args[]){
system.out.println("Fuck off you smelly cock");
}
}
Eclipse gives the error message:
Launch Error
Selection does not cantain a main type
Wat am I doing wrong this time?
It should tell you that it couldn't compile that code.
It's String[] args and System.out. I think you also need to explicitly mark the class as public. And make sure that the filename corresponds to the classname.
public class aoeu {
public static void main(String args[]){
System.out.println("Hello World");
}
}
Worked. I think I just needed to type System.out instead of system.out and String instead of string.
How idiotic of me.
it's also String[] args, not String args[]
<What the shit was I saying>
Anyone used StreamReader before in C#?
I'm current loading in a file by getting the location on my computer for example.
[code]reader = new StreamReader(@"C:\Users\Chris\Desktop\test.txt");[/code]
Is there anyway of added it to the project and just doing it from there? Every time i tired to add a .txt file to the content folder it told me it didn't know how to handle it, so what should i do?
I'm making a word game in C.
1) Where can I find a good plain text dictionary with "word game" type words? A lot of dictionaries I've found either contain tons of unfitting words (non-English words, proper nouns, etc.) or are missing tons of legitimate words. Definitions are not a requirement.
2) What data structure is best for storing a dictionary such that words can be quickly checked? My game requires looking up a lot of words very frequently, so speed is crucial.
[QUOTE=Larikang;30727209]2) What data structure is best for storing a dictionary such that words can be quickly checked? My game requires looking up a lot of words very frequently, so speed is crucial.[/QUOTE]
Depends on what you want to check. If you can store an ID of the current word being processed a dynamic array could work but I dunno.
[editline]27th June 2011[/editline]
And by processed I mean mistyped constantly
[QUOTE=Larikang;30727209]I'm making a word game in C.
1) Where can I find a good plain text dictionary with "word game" type words? A lot of dictionaries I've found either contain tons of unfitting words (non-English words, proper nouns, etc.) or are missing tons of legitimate words. Definitions are not a requirement.
2) What data structure is best for storing a dictionary such that words can be quickly checked? My game requires looking up a lot of words very frequently, so speed is crucial.[/QUOTE]
What exactly do you need to store about the words?
If you only need to store their existence, you could try implementing a [url=http://en.wikipedia.org/wiki/Bloom_filter]bloom filter[/url] that adjusts the lengths and amount of its hashes to fit your dictionaries automatically.
[editline]27th June 2011[/editline]
Don't let the probabilistic nature put you off
I am using a C book I inherited from my grandfather to learn a bit of programming. I have plans to move to C++ and C# soon, but have a couple of questions.
1. Can someone reccomend a better compiler than VB(I am using Visual C++ Express, don't know if there is a difference)? I already see why it is mocked and loathed by most.
2. Whenever I try build my program, I get this error;(F*** YOU VB! :suicide:)
1>------ Build started: Project: MadLib, Configuration: Debug Win32 ------
1>LINK : error LNK2001: unresolved external symbol _mainCRTStartup
1>C:\Users\paindoc\Documents\Visual Studio 2010\Projects\MadLib\Debug\MadLib.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
EDIT; Here is the code itself
[QUOTE=ProgramMadLib]#include <stdio.h>
void main()
{
char adjective[20];
char food[20];
char chore[20];
char furniture[20];
printf("Enter an adjective:");
scanf("%s",adjective);
printf("Enter a food:");
scanf("%s",food);
printf("Enter a chore:");
scanf("%s"chore);
printf("Enter an item of furniture");
scanf("%s"furniture);
printf("\n\nDon't touch theat %s %s!\n",adjective,food);
printf("I just %s the %s\n",chore,furniture);
}
[/QUOTE]
[QUOTE=Jimmylaw;30726379]Anyone used StreamReader before in C#?
I'm current loading in a file by getting the location on my computer for example.
[code]reader = new StreamReader(@"C:\Users\Chris\Desktop\test.txt");[/code]
Is there anyway of added it to the project and just doing it from there? Every time i tired to add a .txt file to the content folder it told me it didn't know how to handle it, so what should i do?[/QUOTE]
You can reference a text file using resources, from there it is pretty easy
I know everyone here must hate these kinds of questions, but could I add someone on Steam to teach me Java? If not, could someone point me in the direction of some good tutorials? I can't find any.
[QUOTE=Jimmylaw;30726379]Anyone used StreamReader before in C#?
I'm current loading in a file by getting the location on my computer for example.
[code]reader = new StreamReader(@"C:\Users\Chris\Desktop\test.txt");[/code]
Is there anyway of added it to the project and just doing it from there? Every time i tired to add a .txt file to the content folder it told me it didn't know how to handle it, so what should i do?[/QUOTE]
add test.txt to your project somewhere, set it's "Build Action" to "None", and set "Copy to Output Directory" to "Copy if newer". Add folders in your project to have it copy into relative subfolders in the Debug / Release folder. then you reference it as local - @"test.txt" or if it's in a folder - @"folderName\test.txt"
[QUOTE=ThePuska;30728290]What exactly do you need to store about the words?
If you only need to store their existence, you could try implementing a [url=http://en.wikipedia.org/wiki/Bloom_filter]bloom filter[/url] that adjusts the lengths and amount of its hashes to fit your dictionaries automatically.
[editline]27th June 2011[/editline]
Don't let the probabilistic nature put you off[/QUOTE]
I do only need to store their existence. I would consider a bloom filter if someone already implemented it in C for me to use, but it looks like a bit of a hassle to make one from scratch.
[QUOTE=paindoc;30728689]I am using a C book I inherited from my grandfather to learn a bit of programming. I have plans to move to C++ and C# soon, but have a couple of questions.
1. Can someone reccomend a better compiler than VB(I am using Visual C++ Express, don't know if there is a difference)? I already see why it is mocked and loathed by most.
[/QUOTE]
You know that Visual Basic is a language, not a program or compiler, right? Visual Basic != Visual Studio.
VC++ Express is propably the best free IDE for Windows. The compiler itself is exactly the same that Microsoft and million other companies use to build their own software.
You also forgot few commas from your lines 15 & 17.
TL;DR: You are using the best compiler possible, the errors are your own fault.
-snip-
[QUOTE=Simspelaaja;30737800]You know that Visual Basic is a language, not a program or compiler, right? Visual Basic != Visual Studio.
VC++ Express is propably the best free IDE for Windows. The compiler itself is exactly the same that Microsoft and million other companies use to build their own software.
You also forgot few commas from your lines 15 & 17.
TL;DR: You are using the best compiler possible, the errors are your own fault.[/QUOTE]
Have you seen the output created by clang? :gizz:
And I think ICC beats the MSVC compiler in terms of the binary output.
Anyway, I think the error was when creating the project; make sure to select Empty Project (or something among the lines).
Been changing my collision code so its not as much of a pile of if statements.
This was the old code that worked perfectly.
[code]
for (int y = 0; y < level.array.GetLength(1); y++)
{
for (int x = 0; x < level.array.GetLength(0); x++)
{
if (level.objectarray[x,y].getsolid())
{
if (level.objectarray[x, y].getRect().Intersects(wizard.getRect()))
{
if (level.objectarray[x, y].getRect().X < wizard.getRect().X)
{
wizard.setPosition(wizard.getPosition().X + 2, wizard.getPosition().Y);
}
else if (level.objectarray[x, y].getRect().X > wizard.getRect().X)
{
wizard.setPosition(wizard.getPosition().X - 2, wizard.getPosition().Y);
}
if (level.objectarray[x, y].getRect().Y < wizard.getRect().Y)
{
wizard.setPosition(wizard.getPosition().X, wizard.getPosition().Y + 2);
}
else if (level.objectarray[x, y].getRect().Y > wizard.getRect().Y)
{
wizard.setPosition(wizard.getPosition().X, wizard.getPosition().Y - 2);
}
}
}
}
}
[/code]
This is the new code i created, now this code should work the same in my head but the collision are pretty broken.
[code]
Tile tile = level.getTile((int)wizard.getPosition().X / 50, (int)wizard.getPosition().Y / 50);
if (tile != null)
{
if (tile.getsolid())
{
if (tile.getRect().X < wizard.getRect().X)
{
wizard.setPosition(wizard.getPosition().X + 2, wizard.getPosition().Y);
}
else if (tile.getRect().X > wizard.getRect().X)
{
wizard.setPosition(wizard.getPosition().X - 2, wizard.getPosition().Y);
}
if (tile.getRect().Y < wizard.getRect().Y)
{
wizard.setPosition(wizard.getPosition().X, wizard.getPosition().Y + 2);
}
else if (tile.getRect().Y > wizard.getRect().Y)
{
wizard.setPosition(wizard.getPosition().X, wizard.getPosition().Y - 2);
}
}
}
[/code]
Can anyone see any differences that might be causing the strange collision differences?
Without knowing what exactly hapens or the rest of your code
my guess is this
[code]Tile tile = level.getTile((int)wizard.getPosition().X / 50, (int)wizard.getPosition().Y / 50);[/code]
Why are you dividing the positions by 50?
[QUOTE=Richy19;30739228]Without knowing what exactly hapens or the rest of your code
my guess is this
[code]Tile tile = level.getTile((int)wizard.getPosition().X / 50, (int)wizard.getPosition().Y / 50);[/code]
Why are you dividing the positions by 50?[/QUOTE]
Position / tile size = position in the array
getTile does this.
[code]
public Tile getTile(int x, int y)
{
if (x < 0)
return null;
if (y < 0)
return null;
if (x >= 6)
return null;
if (y >= 6)
return null;
return objectarray[x, y];
}
[/code]
Quick question:
If I were to use a library that is GPL'd (v2) and want to release a non-commercial free application, [b]must[/b] I release the source code of the application, too?
Some libraries (e.g. libstdc++) provide exceptions so you don't have to.
However, if you use a library using the 'pure' GPL, then you indeed have to.
You don't have to redistribute the source-code along, but just provide the means to obtain it (e.g. a download link).
Anyone know any good places to learn about making android apps? I have experience with Java but haven't done a lot of work with anything that used GUIs. Should I just start messing around with the SDK?
Sorry, you need to Log In to post a reply to this thread.