• What Do You Need Help With? V6
    7,544 replies, posted
I posted this in the Unity thread, but I guess it belongs here too. I've hit a bit of an issue with my collisions, and after a few hours of problem solving I still can't figure out what's up. I've got a character set up, with seperate collision boxes/spheres for head, body and feet collisions (ceiling, walls, ground). [IMG]http://i.gyazo.com/88a86c1b0b50e1dc8daba89d831498a5.png[/IMG] I've got a semi-grid based world, where I'm using a prefab square with an attached 2D box collider that I'm manually duplicating. The character's ground collisions are essentially: [code]void CollideFeet() { if ((feetColliderL.colliding) | (feetColliderR.colliding)) { touchGround = true; } else if ((feetColliderL.colliding == false) & (feetColliderR.colliding == false)) { touchGround = false; print ("off--------------ground"); } }[/code] The issue I'm getting is that as my character moves from square to square, both feet report that they're not colliding with the world at the same time. Once inertia takes them a little ways further, they collide again. I thought that having two seperate feet colliders would solve this, as I assumed it was an issue with entering square 2 before leaving square 1, resulting in square 2 setting player's collision to true then square 1 setting it to false a moment later, but this doesn't seem to be the case when both feet are giving me a non-collision report at the same time. Any ideas?
Does anyone here have any experience with microsoft fakes? I'm trying to detour a function of another program, but all the tutorials are for system libs or applications you have the source code for. Here is my code: [t]http://a.pomf.se/wcohmm.png[/t]
Does anyone have any small projects that I can work on in Java that are simple to do, but just good programming practice and experience?
[QUOTE=NixNax123;46148701]Does anyone have any small projects that I can work on in Java that are simple to do, but just good programming practice and experience?[/QUOTE] You could make a program to convert a .jpg to a .png or something along those lines. Or import a .png and change it to black and white. It seems complicated, but once you have the file input correct, you just have to learn the specifications of the file format and create your own parser/lexer. Should be relatively simple and fun with the proper documentation.
Anyone know of a way to use regex to select whole words? For example, even including the quotes. "This is some text." "Yolo, swag, and bae." The words I want to select, "[B][U]This[/U] [U]is[/U] [U]some[/U] [U]text[/U][/B]." "[U][B]Yolo[/B][/U], [U][B]swag[/B][/U], [U][B]and[/B][/U] [U][B]bae[/B][/U]." I am still in my infancy with my ruby knowledge as well as regex. So I'm trying to expand on it.
[QUOTE=Duskling;46148857]You could make a program to convert a .jpg to a .png or something along those lines. Or import a .png and change it to black and white. It seems complicated, but once you have the file input correct, you just have to learn the specifications of the file format and create your own parser/lexer. Should be relatively simple and fun with the proper documentation.[/QUOTE]Oooh! Good idea! I'll try that, and I'll learn stuff too! I love learning stuff like that, that's actually useful. [editline]4th October 2014[/editline] [QUOTE=blacksam;46149107]Anyone know of a way to use regex to select whole words? For example, even including the quotes. "This is some text." "Yolo, swag, and bae." The words I want to select, "[B][U]This[/U] [U]is[/U] [U]some[/U] [U]text[/U][/B]." "[U][B]Yolo[/B][/U], [U][B]swag[/B][/U], [U][B]and[/B][/U] [U][B]bae[/B][/U]." I am still in my infancy with my ruby knowledge as well as regex. So I'm trying to expand on it.[/QUOTE] [code]\s*("[^"]+"|[^ ,]+)[/code] that would include stuff enclosed in quotes too [editline]4th October 2014[/editline] of course if you don't need any of that you could just use [code]\S+[/code] [editline]4th October 2014[/editline] i could be terribly wrong though
[QUOTE=NixNax123;46148701]Does anyone have any small projects that I can work on in Java that are simple to do, but just good programming practice and experience?[/QUOTE] Make a program that converts a number of one base (say, base 10), and converts it to another base (say, hexadecimal). No using Logarithms
[QUOTE=proboardslol;46149674]Make a program that converts a number of one base (say, base 10), and converts it to another base (say, hexadecimal). No using Logarithms[/QUOTE] Okay!
[QUOTE=NixNax123;46149173]Oooh! Good idea! I'll try that, and I'll learn stuff too! I love learning stuff like that, that's actually useful. [editline]4th October 2014[/editline] [code]\s*("[^"]+"|[^ ,]+)[/code] that would include stuff enclosed in quotes too [editline]4th October 2014[/editline] of course if you don't need any of that you could just use [code]\S+[/code] [editline]4th October 2014[/editline] i could be terribly wrong though[/QUOTE] It's all good in the hood. I was fiddling around with it, found (/(\w+)/) works for what I want.
[QUOTE=proboardslol;46149674]Make a program that converts a number of one base (say, base 10), and converts it to another base (say, hexadecimal). No using Logarithms[/QUOTE] blam [code]public class BaseConverter { public static String convert(int n, int radix) { String result = ""; int v = 1; while(v <= n/radix) v *= radix; while(v > 0) { if(n < v) result += "0"; else { int place = n/v % radix; if(place < 10) result += place; else switch (place) { case 10: result += "A"; break; case 11: result += "B"; break; case 12: result += "C"; break; case 13: result += "D"; break; case 14: result += "E"; break; case 15: result += "F"; } n -= v; } v /= radix; } return result; } public static void main(String[] args) { int n = 231; System.out.println(convert(n, 2)); System.out.println(convert(n, 10)); System.out.println(convert(n, 16)); } }[/code] [img]http://i.imgur.com/WW7clfS.png[/img] (: [editline]4th October 2014[/editline] Only handles up to base 16, but it's easily modifiable to include more bases.
Write a divide and conquer sorting algorithm.
[QUOTE=FalconKrunch;46150289]Write a divide and conquer sorting algorithm.[/QUOTE] What does that mean?
[QUOTE=NixNax123;46150560]What does that mean?[/QUOTE] A divide and conquer algorithm is one that divides one big task up into smaller tasks until it's trivial to solve, take a look at merge sort or quicksort.
[QUOTE=FalconKrunch;46150611]A divide and conquer algorithm is one that divides one big task up into smaller tasks until it's trivial to solve, take a look at merge sort or quicksort.[/QUOTE] Oh, so like binary sort!
yes
snip
at my mum's engagement party last night, I met a man who owns a large software company and after some talking he said he'll give me a job programming for him over the summer. Now I've got a few months until then and I'm very rusty at C++ so I was hoping that I could get some good resources to brush up. Also he said he has some ideas for a few apps and I don't know how to develop apps. this is a big opportunity for me and I don't want to fuck it up.
[QUOTE=proboardslol;46149674]Make a program that converts a number of one base (say, base 10), and converts it to another base (say, hexadecimal). No using Logarithms[/QUOTE] [img]http://i.imgur.com/0CFjK6w.png[/img] i learned even more by making a GUI for it! (:
[QUOTE=NixNax123;46150024]blam [code]public class BaseConverter { public static String convert(int n, int radix) { String result = ""; int v = 1; while(v <= n/radix) v *= radix; while(v > 0) { if(n < v) result += "0"; else { int place = n/v % radix; if(place < 10) result += place; else switch (place) { case 10: result += "A"; break; case 11: result += "B"; break; case 12: result += "C"; break; case 13: result += "D"; break; case 14: result += "E"; break; case 15: result += "F"; } n -= v; } v /= radix; } return result; } public static void main(String[] args) { int n = 231; System.out.println(convert(n, 2)); System.out.println(convert(n, 10)); System.out.println(convert(n, 16)); } }[/code] [img]http://i.imgur.com/WW7clfS.png[/img] (: [/quote] comment your code d00d [editline]4th October 2014[/editline] [QUOTE=Pat.Lithium;46152077]at my mum's engagement party last night, I met a man who owns a large software company and after some talking he said he'll give me a job programming for him over the summer. Now I've got a few months until then and I'm very rusty at C++ so I was hoping that I could get some good resources to brush up. Also he said he has some ideas for a few apps and I don't know how to develop apps. this is a big opportunity for me and I don't want to fuck it up.[/QUOTE] Am I the only one who has an innate distrust of business types? Like when they say they'll give you a job just for knowing them, I fear it always turns out that they work for vector marketing or some shit edit: read Barney Toasterstrudel
[QUOTE=proboardslol;46153172]comment your code d00d [editline]4th October 2014[/editline] Am I the only one who has an innate distrust of business types? Like when they say they'll give you a job just for knowing them, I fear it always turns out that they work for vector marketing or some shit edit: read Barney Toasterstrudel[/QUOTE] I commented the shit out of it, and improved the functionality, I'll post it tomorrow because I'm in bed now!
[QUOTE=NixNax123;46148701]Does anyone have any small projects that I can work on in Java that are simple to do, but just good programming practice and experience?[/QUOTE] [url]https://www.reddit.com/r/dailyprogrammer[/url]
Someone worked with EasyHook before? My injected DLL somehow does not get ejected, it stays in the Process. Already looked at their codeplex site, but did not find any answers yet. Is there any way to properly remove the injected DLL from the process?
I'm looking at an introductory programming class that uses Python. One of the tasks is writing a stopwatch. I'm having trouble with the function that formats time into a string. The string must have this format: A:BC:D where A is minutes, BC is seconds and D is tenths of seconds. I'm having trouble with it once the timer hits 1 minute. I can't find a way to reset the tens/seconds/tenths back to 00.0 and then keep counting from scratch and I dunno how else to do it. Maths has never been my strong suit. Here is what I have: [code]def format(t): timelist = [0, 0, 0, 0] if t < 10: timelist[3] = str(t)[-1] elif t >= 10 and t < 100: timelist[3] = str(t)[-1] timelist[2] = str(t)[-2] elif t >= 100 and t < 600: timelist[3] = str(t)[-1] timelist[2] = str(t)[-2] timelist[1] = str(t)[-3] elif t % 60 == 0: timelist[0] += 1 timeText = str(timelist[0]) + ':' + str(timelist[1]) + str(timelist[2]) + '.' + str(timelist[3]) return timeText[/code] I'm not supposed to import other modules here other than the one we use for the GUI+timer. I've been googling to no avail, I'm pretty sure I'm just being retarded with numbers. But my head is starting to hurt so if someone can give me some pointers I'd appreciate it.
[QUOTE=Duskling;46148857]You could make a program to convert a .jpg to a .png or something along those lines. Or import a .png and change it to black and white. It seems complicated, but once you have the file input correct, you just have to learn the specifications of the file format and create your own parser/lexer. Should be relatively simple and fun with the proper documentation.[/QUOTE] Ok, so I've started out making an Image class (seemed the most logical thing to do) [code]public class Image { /** * filename for image */ public String filename; /** * image extension */ public String ext; /** * width of image */ public int width; /** * height of image */ public int height; /** * various image effects */ public enum Effect { /* * no effect */ NO_EFFECT, /* * black & white effect */ NOIR } /** * image effect */ public Effect effect; /** * loads and displays an image with desired effect * @param filename filename of image to be loaded * @param ext extension of image to be loaded * @param width width of image to be displayed * @param height height of image to be displayed * @param effect effect of image to be displayed */ public Image( String filename, String ext, int width, int height, Effect effect) { this.filename = filename; this.ext = ext; this.width = width; this.height = height; this.effect = effect; // not implemented yet // this.display(); } [/code] But I really don't know how to set up classes in a way that makes sense. I've never been taught, and never had a good resource. So what should I do from here? Is my class alright so far? Can anyone give me an example skeleton of my class to help me out?
[QUOTE=NixNax123;46157265]Ok, so I've started out making an Image class (seemed the most logical thing to do) [code]public class Image { /** * filename for image */ public String filename; /** * image extension */ public String ext; // image width /** * width of image */ public int width; // image height /** * height of image */ public int height; /** * various image effects */ public enum Effect { /* * no effect */ NO_EFFECT, /* * black & white effect */ NOIR } /** * image effect */ public Effect effect; /** * loads and displays an image with desired effect * @param filename filename of image to be loaded * @param ext extension of image to be loaded * @param width width of image to be displayed * @param height height of image to be displayed * @param effect effect of image to be displayed */ public Image( String filename, String ext, int width, int height, Effect effect) { this.filename = filename; this.ext = ext; this.width = width; this.height = height; this.effect = effect; // not implemented yet // this.display(); } [/code] But I really don't know how to set up classes in a way that makes sense. I've never been taught, and never had a good resource. So what should I do from here? Is my class alright so far? Can anyone give me an example skeleton of my class to help me out?[/QUOTE] Everything seems alright. The file extension should be it's own class. You would have a Type ( or something ) base class and then like a PNG class or TGA class, each with their own specifications built right into the class so that you can write importers based of of those classes.
[QUOTE=Duskling;46157882]Everything seems alright. The file extension should be it's own class. You would have a Type ( or something ) base class and then like a PNG class or TGA class, each with their own specifications built right into the class so that you can write importers based of of those classes.[/QUOTE] That makes sense, thank you! I'll report on my progress! [editline]5th October 2014[/editline] [QUOTE=Duskling;46157882]Everything seems alright. The file extension should be it's own class. You would have a Type ( or something ) base class and then like a PNG class or TGA class, each with their own specifications built right into the class so that you can write importers based of of those classes.[/QUOTE] So I'm making a Format class, and the PNG/TGA/etc classes will be subclasses of that. What methods/fields should I give to Format? I'm not quite sure.
[QUOTE=meek;46156340]I'm looking at an introductory programming class that uses Python. One of the tasks is writing a stopwatch. I'm having trouble with the function that formats time into a string. The string must have this format: A:BC:D where A is minutes, BC is seconds and D is tenths of seconds. I'm having trouble with it once the timer hits 1 minute. I can't find a way to reset the tens/seconds/tenths back to 00.0 and then keep counting from scratch and I dunno how else to do it. Maths has never been my strong suit. Here is what I have: [code] I'm not supposed to import other modules here other than the one we use for the GUI+timer. I've been googling to no avail, I'm pretty sure I'm just being retarded with numbers. But my head is starting to hurt so if someone can give me some pointers I'd appreciate it.[/QUOTE] There are two things you can do here to make your life easier. The first is to do with converting from seconds to minutes/seconds/tenths-of-seconds, the easy way to do this is to use the modulo operator and divide and round down, in Python the modulo operator is % and although you've used it at the bottom the else-if chain won't reach it until t is greater then 600, and even then if t is a floating point t % 60 will probably never be 0. The modulo operator gives you the remained when you divide by something so: [code]65 % 60 = 5[/code] As a minute is 60 seconds you can use this to determine how many seconds you have left over after you have your minutes. To get your minutes you can use // which, in Python, divides and rounds down so [code] 65 // 60 = 1[/code] Or if you have less than a minute [code] 55 // 60 = 0[/code] So using these you can turn a number of seconds into minutes, seconds and tenths of seconds. The next is formatting the numbers as a string. Rather than keeping track of the tens and seconds and single digits of seconds separately, the above will give you a two digit number, if you were to just use str() on it you wouldn't always get two digits e.g [code]str(5) = '5'[/code] Python includes some string formatting capabilities that can help you get around this. The simple way is to create a format string that acts as a template and then fill it in with your values, this makes use of % again, but this time in relation to strings rather than numbers so the effect is different. If you just had minutes and seconds you could do "%d:%d", here the %d will eventually be replaced with something, the 'd' means it will be a number and in particular an integer number. To actually do the replacement you would do [code] "%d:%d" % (5,6) = '5:6'[/code] Note: you need to put the things you're putting into the string in brackets if you have more than one item and they're placed in the string in the order they're given. The in order to force the seconds to be two digits you can do "%d:%02d", when replacing this will give: [code]"%d:%02d" % (5,6) = '5:06'[/code] Where the 02 before the d specifies that the number should always be a minimum of two digits (so you could still put 500 into the %02d just fine). This ended up being quite a long post but it should give you everything you need, and while I've only talked about minutes and seconds extending it to m:ss:t shouldn't be too difficult.
I am making a chat application for Windows Desktop (C#), Android (Java) and Browser. What would be the best way to make sure that in all 3 clients user sends and receives messages instantly? I mean is there ONE service that could provide this all? So far I found GCM (Google Cloud Messaging) and WebSockets, however it seems that GCM is same as WebSockets except it's all automated (I think). I mean I could call refresh in all clients every second but that seems like a huge resource waste. Browsr could use Ajax I guess to get newest chat messages. Android could use GCM. But what can Windows use? I've never really properly made Windows software. Any suggestions? Thanks.
[QUOTE=NixNax123;46157896] So I'm making a Format class, and the PNG/TGA/etc classes will be subclasses of that. What methods/fields should I give to Format? I'm not quite sure.[/QUOTE] I'm unsure, never really dealt with file header specifications. You would probably have variables that hold the difference, in bytes, between each part of the file header, as well as ways to store the header format.
I've been messing around with Sublime Text 3 plugins ( my first time using Python ) and I can't seem to figure out what the args argument wants. I've tried using a mapping, which seems to be what it wants, but it gives me this error: [code] >>> view.run_command( 'example', { 'one': 1 } ) Traceback (most recent call last): File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 543, in run_ return self.run(edit, **args) TypeError: run() got an unexpected keyword argument 'one' [/code] Any suggestions?
Sorry, you need to Log In to post a reply to this thread.