This is more of a general question not a specific coding one, but in school we got this assignment to make our own dungeon RPG console explorer game you know the one with tons of text where you type where to go, etc. My question here to the more experienced programmers is what would be the best way to fundamentally approach this like read the text from a file and store the play options into an array, etc. I am open to having to learn anything new. Thanks in advance.
Objected Oriented programming is Java's forte. If you are going with Java, try to take advantage of these primitives.
For example, reading everything from a file and having a user select inputs with his keyboard would be something more akin to scripting, which you could perfectly do with something like Python and would therefore be a situation of using a rocket launcher to kill a mouse.
The array thing, not sure what you mean, but generally storing such information statically in an array is generally not a good idea, especially if the information is already stored in files (unless you're going to be using them all of the time).
Related
I am very new to Java programming and I have a question about a project I am working on.
I need to, essentially, have a way to reference A string after the user has given me some input. This input will be through buttons i set up and this String will be about a paragraph long. I have been looking around the internet and I think what I need is to "Provide Resources" and "Access Resources" so that my code isn't filled with paragraphs of Strings.
I also have a fair amount of questions about how this works:
Is this more a question of Data and Storage? or both?
Do I have to go through ResourceBundling? What is that and where can i go so I can learn about it enough to be able to apply it?
Will I have to put all this data on the internet and have the app reference it through the web or can it somehow be downloaded with the app so the user can use it without having an internet connection? (It's a lot of data, I mean like a Lot)
I am more than willing to put in the time to learn this but I just need to be pointed in the right direction. A little insight on what to focus on, where to go to find it, or what keywords or concepts I should be looking for would be more help than you know.
Thank you for your time.
I have a project which developing a java program - packet tracer alike. I have managed to get the most of GUI done with movable PCs, popup, etc.. but i'm totally clueless about the best way to give PCs IPs, Subneting and further development like Ping, tracert etc....
Can anyone enlighten me with any idea?
Picture
https://www.dropbox.com/s/wq9bowrwwmib6kx/1.png
https://www.dropbox.com/s/eas558lr80evxeg/2.png
Simple object oriented programming. First make object classes for what you need. store these objects in an arrey after you create them. Its kind of like your own little database for your program. When they need to be used run a for loop to check for the object you need. You can save these list so the user can reopen your program and continue working from where they left off.
I have been looking from everywhere how would it be possible to make a save game file in java applet but of course it is not possible to just make an xml file... (or would it? please tell me!)
I don't want to make the "player" to log in to game with username, password and stuff like that, that goes to some server and things like that...
Just what would be the easiest and the most simple way to save a couple of variables so the player don't need to start the game from the beginning every time? (Becouse in an rpg game it would be so lame...)
Generally you can't save files, because of the security restrictions. Unless it's running as a trusted applet, which is problematic. The short answer is no, you can't write files, because Java applets runs in sandbox. From sandbox you don't see the local file system.
Maybe you can store your save game in a cookie? Here you have an official tutorial how to handle cookies from Java.
This link can be also helpful, somebody had a similar question.
I'm toying with an idea for creating a Java application to automate a process that I have to do regularly and before I start any coding I thought I would seek advice as to the best way to approach it.
Basically, the application I use has a large number of images present on the screen at any one time, and what I would like to know is if there is a way to have Java identify if any of these two images are the same. If they are, I would like to automate mouse movement and button clicks.
After a bit of reading, I'm thinking that the PixelGrabber and Robot classes might be the right way to start, but like I said, I'm looking for any information on this that can be offered.
What are your suggestions?
I believe the Robot class and a Pixel Grabber would be sufficient. If you are inclined to program the solution yourself, maybe for educational purpose, by all means please do. If you, however, don't want to reinvent the wheel, you may take a look at this project:
http://sikuli.org/
I, for example, use it to do stuff that would be hard to achieve with Selenium alone. If you still can't achieve your goal after some scripting, Sikuli provides a nice API which you can use from inside your java program.
The Robot class would be sufficient to take images and being able to inspect pixels. But it seems to make more sense, to recreate your desktop with images inside of a java application (a very simple gallery application). Then operations are simplier. An other way of realizing operations I do not see.
I am a cameraman and I want to make an app for my Moto Droid that will
calculate my depth of field given four inputs.
I am literally brand
new to javascript and this programming stuff, so I was wondering if
anyone could help me out.
I have a very basic GUI set up using Droiddraw which allows me to
input my 4 variables, which are:
Focus (#+id/focust)
Focal Length (#+id/flt)
Aperture (#+id/apt)
Circle of Confusion (#+id/coct)
Equations for this calculation are located here
for example...
to get hyperfocal distance I need to get: ((f^2)/(N*c))+f
all of these variables will be drawn from inputs in the GUI, but I don't know how to call them, how to write the actual math, and how to address the results so I can make them appear in the "results area" on the bottom of the screen.
I've never done java before and I only want to make this app because the existing ones don't fit my needs.
Can someone help?
Thanks!
If I'm not mistaken, DroidDraw is a tool for building the XML user interface description used by the Java API. If you want to program for Android in JavaScript, something like PhoneGap might be a better choice. It lets you build real Android application using HTML and JavaScript.
On the other hand, if you want to use the XML and Java APIs, then you should probably run through the Android tutorials. The first one is Hello, World.
Since you're just getting started with programming, I can't stress tutorials enough. It's true that your idea shouldn't be too hard to implement, but you need to understand the basics first.
I don't mean to give the impression that one style (PhoneGap vs. Java and XML) is better. For your purposes, either should be fine. It's more a question of what you prefer. Java/XML is the paradigm supported by Google, and provides access to more functionality. On the other hand, if you already know HTML or JavaScript (or are interested in learning them), PhoneGap will certainly provide everything you need. I think PhoneGap is also intended to make it easier for beginners, though I haven't used it, so I don't know how successful they have been.
The XML file that is generated by DroidDraw can't be used within PhoneGap. If you do choose to use PhoneGap, then you will need to build the interface in HTML. You might be able to use something like DreamWeaver or FrontPage or one of any number of HTML editors to help you with this step.
The XML file is just a description of an interface. When you start your application, the Android platform uses this description to build the user interface that you see. Once that has happened, you can move data from the interface to Java, or from Java to the interface, without any hassle. You certainly won't be limited by the XML interface description - it's pretty flexible.
If you've been going through the Android tutorials, then it might be best to forget that I even mentioned PhoneGap. It's a wildly different alternative that is the right choice for some people and some applications. But the Android tutorials won't help you to understand it. I only brought it up because you mentioned JavaScript in your original post.