Search Results

Search found 156 results on 7 pages for 'corey whitaker'.

Page 2/7 | < Previous Page | 1 2 3 4 5 6 7  | Next Page >

  • Java - 2d Array Tile Map Collision

    - by Corey
    How would I go about making certain tiles in my array collide with my player? Like say I want every number 2 in the array to collide. I am reading my array from a txt file if that matters and I am using the slick2d library. Here is my code if needed. public class Tiles { Image[] tiles = new Image[3]; int[][] map = new int[500][500]; Image grass, dirt, mound; SpriteSheet tileSheet; int tileWidth = 32; int tileHeight = 32; public void init() throws IOException, SlickException { tileSheet = new SpriteSheet("assets/tiles.png", tileWidth, tileHeight); grass = tileSheet.getSprite(0, 0); dirt = tileSheet.getSprite(7, 7); mound = tileSheet.getSprite(2, 6); tiles[0] = grass; tiles[1] = dirt; tiles[2] = mound; int x=0, y=0; BufferedReader in = new BufferedReader(new FileReader("assets/map.txt")); String line; while ((line = in.readLine()) != null) { String[] values = line.split(","); for (String str : values) { int str_int = Integer.parseInt(str); map[x][y]=str_int; //System.out.print(map[x][y] + " "); y=y+1; } //System.out.println(""); x=x+1; y = 0; } in.close(); } public void update() { } public void render(GameContainer gc) { for(int x = 0; x < 50; x++) { for(int y = 0; y < 50; y ++) { int textureIndex = map[y][x]; Image texture = tiles[textureIndex]; texture.draw(x*tileWidth,y*tileHeight); } } } } I tried something like this, but I it doesn't ever "collide". X and y are my player position. if (tiles.map[(int)x/32][(int)y/32] == 2) { System.out.println("Collided"); }

    Read the article

  • Java - Tile engine changing number in array not changing texture

    - by Corey
    I draw my map from a txt file. Would I have to write to the text file to notice the changes I made? Right now it changes the number in the array but the tile texture doesn't change. Do I have to do more than just change the number in the array? public class Tiles { public Image[] tiles = new Image[5]; public int[][] map = new int[64][64]; private Image grass, dirt, fence, mound; private SpriteSheet tileSheet; public int tileWidth = 32; public int tileHeight = 32; Player player = new Player(); public void init() throws IOException, SlickException { tileSheet = new SpriteSheet("assets/tiles.png", tileWidth, tileHeight); grass = tileSheet.getSprite(0, 0); dirt = tileSheet.getSprite(7, 7); fence = tileSheet.getSprite(2, 0); mound = tileSheet.getSprite(2, 6); tiles[0] = grass; tiles[1] = dirt; tiles[2] = fence; tiles[3] = mound; int x=0, y=0; BufferedReader in = new BufferedReader(new FileReader("assets/map.dat")); String line; while ((line = in.readLine()) != null) { String[] values = line.split(","); for (String str : values) { int str_int = Integer.parseInt(str); map[x][y]=str_int; //System.out.print(map[x][y] + " "); y=y+1; } //System.out.println(""); x=x+1; y = 0; } in.close(); } public void update(GameContainer gc) { } public void render(GameContainer gc) { for(int x = 0; x < map.length; x++) { for(int y = 0; y < map.length; y ++) { int textureIndex = map[y][x]; Image texture = tiles[textureIndex]; texture.draw(x*tileWidth,y*tileHeight); } } } Mouse picking public void checkDistance(GameContainer gc) { Input input = gc.getInput(); float mouseX = input.getMouseX(); float mouseY = input.getMouseY(); double mousetileX = Math.floor((double)mouseX/tiles.tileWidth); double mousetileY = Math.floor((double)mouseY/tiles.tileHeight); double playertileX = Math.floor(playerX/tiles.tileWidth); double playertileY = Math.floor(playerY/tiles.tileHeight); double lengthX = Math.abs((float)playertileX - mousetileX); double lengthY = Math.abs((float)playertileY - mousetileY); double distance = Math.sqrt((lengthX*lengthX)+(lengthY*lengthY)); if(input.isMousePressed(Input.MOUSE_LEFT_BUTTON) && distance < 4) { System.out.println("Clicked"); if(tiles.map[(int)mousetileX][(int)mousetileY] == 1) { tiles.map[(int)mousetileX][(int)mousetileY] = 0; } } System.out.println(tiles.map[(int)mousetileX][(int)mousetileY]); }

    Read the article

  • How do you name your projects?

    - by Corey
    Naming is hard. Really, really hard. Even StackExchange is a prime example of this -- remember the huge domain name controversy that occurred when SE sites first started graduating? Anyway, I've got a project I'm working on but I have no idea what to name it! This simple fact has caused production to cease, because I'm at the point where I want to create repositories and database tables, and I don't want to name everything "Untitled project" and have to change potentially hundreds of lines of code in the future. Also, I would like to collaborate with others but it's difficult to be taken seriously if I refer to this as "some project I'm working on." It makes it seem like a new project in its infancy and doesn't garner a lot of interest. Just the simple fact act of having a name will make a huge impact in how it registers in others' minds. How do you guys name your projects? This particular one is a website, so not only do I need to find a good name, I need to find one with an available domain, which is next to impossible these days. How do you brainstorm? Who do you talk to (or not talk to)? Is there an "eureka!" moment when you stumble across something that works?

    Read the article

  • How does one specify raster operations in XNA?

    - by Corey Ogburn
    I'm looking for a way to add a sprite using a particular logic operation (like XOR). I can't find anything on Google and I'm not sure where to look in the documentation. I've looked into SpriteBatch.Begin(...) and its Draw method and several options in the GraphicsDevice class, but I'm not recognizing anything capable of this. I'm still pretty new to XNA so I may just not have recognized the terminology to do this.

    Read the article

  • In what order do people build websites?

    - by Corey
    For a website, you need to have an idea, you need to have a design and you need to have data, events and output, right? Whether it be a blog, web app, Q&A site, search engine... Anyway, that is only slightly related to my question. My question is, when designing a website, providing I know the purpose, what should I start with? Should I start with the CSS, design and look&feel using dummy data first, or should I program in the logic, events and output, and style it later? What is the design process of most websites that are built from the ground up?

    Read the article

  • How important is the uniqueness of your domain name?

    - by Corey
    I've finally come up with a domain name that I like and is available. The name is nonsensical and doesn't translate into anything meaningful in any language, as far as I know. It's something like "FOOBARite". (Don't steal that!) I'm wondering about a few search issues. Results-wise, searching for it in Google currently returns about 15k results, none of which are relevant (dead Twitter pages, various unpopular online handles, and botched french translations). However, Google starts off with a spelling suggestion, which removes a letter. ("Did you mean: FOOBARit?") That returns about 250k results for several different and unrelated websites/organizations by that name. One is some technology provider, another is a sign-language organization, another is the name of a font... None of them seem particularly popular, there's not that much activity on any of those pages. Anyway, the two are pronounced differently, they're just a letter off. Should I go with my idea or is this one-letter variation going to cause me problems? If my site becomes ranked well enough, will Google's spelling suggestion go away? I don't want users to search for my site name and be told they've spelled it wrong.

    Read the article

  • Java Slick2d - Mouse picking how to take into account camera

    - by Corey
    When I move it it obviously changes the viewport so my mouse picking is off. My camera is just a float x and y and I use g.translate(-cam.cameraX+400, -cam.cameraY+300); to translate the graphics. I have the numbers hard coded just for testing purposes. How would I take into account the camera so my mouse picking works correctly. double mousetileX = Math.floor((double)mouseX/tiles.tileWidth); double mousetileY = Math.floor((double)mouseY/tiles.tileHeight); double playertileX = Math.floor(playerX/tiles.tileWidth); double playertileY = Math.floor(playerY/tiles.tileHeight); double lengthX = Math.abs((float)playertileX - mousetileX); double lengthY = Math.abs((float)playertileY - mousetileY); double distance = Math.sqrt((lengthX*lengthX)+(lengthY*lengthY)); if(input.isMousePressed(Input.MOUSE_LEFT_BUTTON) && distance < 4) { if(tiles.map[(int)mousetileX][(int)mousetileY] == 1) { tiles.map[(int)mousetileX][(int)mousetileY] = 0; } } That is my mouse picking code

    Read the article

  • Normal vector of a face loaded from an FBX model during collision?

    - by Corey Ogburn
    I'm loading a simple 6 sided cube from a UV-mapped FBX model and I'm using a BoundingBox to test for collisions. Once I determine there's a collision, I want to use the normal vector of the collided surface to correct the movement of whatever collided with the cube. I suppose this is a two-part question: 1) How can I determine which face of the cube was collided with in a collision? 2) How can I get the normal vector of that surface?

    Read the article

  • Can't access windows 7 shared files on Ubuntu 11.10

    - by Corey
    I just set up ubuntu 11.10 and Samba. I got it to access shares on a Vista machine, but when I try to access the shares on a windows 7 machine it asks for a Username, Domain, and Password. I have no password set up on the windows 7 machine so I put in the username, and domain try to connect and the password prompt keeps appearing...also tried guest and admin with no luck...I've tried many different fixes(modifying registry entries & advanced securities on the win 7 machine) with no luck. Thanks

    Read the article

  • In what order do people build websites?

    - by Corey
    For a website, you need to have an idea, you need to have a design and you need to have data, events and output, right? Whether it be a blog, web app, Q&A site, search engine... Anyway, that is only slightly related to my question. My question is, when designing a website, providing I know the purpose, what should I start with? Should I start with the CSS, design and look&feel using dummy data first, or should I program in the logic, events and output, and style it later? What is the design process of most websites that are built from the ground up?

    Read the article

  • Java - Finding distance between player and tile in array

    - by Corey
    What is the best way performance wise to do this? When I click a tile I want it to get the distance and if I am close enough I can interact with the tile. One way would be to find the tile by doing mouse / tile width when I click correct? But then how would I get that tiles position? I know how to find the distance I just don't know how to get a certain tiles position from the array when I click it

    Read the article

  • Rubygems on Debian: Gems won't load (LoadError)

    - by daswerth
    I've installed the development version of Crunchbang, a linux distro based off Debian. I got Ruby and Rubygems installed, but I can't get the gems I've installed to load. Here is a command-line session: $ ruby -v ruby 1.9.1p378 (2010-01-10 revision 26273) [i486-linux] $ gem env RubyGems Environment: - RUBYGEMS VERSION: 1.3.6 - RUBY VERSION: 1.9.1 (2010-01-10 patchlevel 378) [i486-linux] - INSTALLATION DIRECTORY: /usr/lib/ruby1.9.1/gems/1.9.1 - RUBY EXECUTABLE: /usr/bin/ruby1.9.1 - EXECUTABLE DIRECTORY: /usr/bin - RUBYGEMS PLATFORMS: - ruby - x86-linux - GEM PATHS: - /usr/lib/ruby1.9.1/gems/1.9.1 - /home/corey/.gem/ruby/1.9.1 - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - http://rubygems.org/ $ echo $PATH /home/corey/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/home/corey/.gem/ruby/1.9.1:/usr/lib/ruby1.9.1/gems/1.9.1 $ gem list -d nokogiri `*** LOCAL GEMS ***` nokogiri (1.4.1) Authors: Aaron Patterson, Mike Dalessio Rubyforge: http://rubyforge.org/projects/nokogiri Homepage: http://nokogiri.org Installed at: /usr/lib/ruby1.9.1/gems/1.9.1 Nokogiri (?) is an HTML, XML, SAX, and Reader parser $ ruby -r rubygems -e "require 'nokogiri'" -e:1:in `require': no such file to load -- nokogiri (LoadError) from -e:1:in `' I've encountered similar problems on Ubuntu before, but they were easy to fix. I can't figure out what's wrong in this particular case, and Google didn't seem to know either. Any help would be greatly appreciated! By the way... this is my first submission to stackoverflow. I hope this question is relevant. :)

    Read the article

  • Comparing char for validation in C++

    - by Corey Starbird
    /* PROGRAM: Ch6_14.cpp Written by Corey Starbird This program calculates the balance owed to a hospital for a patient. Last modified: 10/28/13 */ #include <iostream> #include <fstream> #include <iomanip> #include <string> using namespace std; // Prototypes for In-patient and Out-patient functions. double stayTotal (int, double, double, double); // For In-patients double stayTotal (double, double); // For Out-patients int main() { char patientType; // In-patient (I or i) or Out-patient (O or o) double rate, // Daily rate for the In-patient stay servCharge, // Service charge for the stay medCharge, // Medication charge for the stay inTotal, // Total for the In-patient stay outTotal; // Total for the Out-patient stay int days; // Number of days for the In-patient stay // Find out if they were an In-patient or an Out-patient cout << "Welcome, please enter (I) for an In-patient or (O) for an Out-patient:" << endl; cin >> patientType; while (patientType != 'I' || 'i' || 'O' || 'o') { cout << "Invalid entry. Please enter either (I) for an In-patient or (O) for an Out-patient:" << endl; cin >> patientType; } cout << "FIN"; return 0; } Hey, brand new to C++ here. I am working on a project and I'm having trouble figuring out why my validation for patientTypeisn't working properly. I first had double quotes, but realized that would denote strings. I changed them to single quotes, my program will compile and run now, but the while loop runs no matter what I enter, I, i, O, o, or anything else. I don't know why the while loop isn't checking the condition, seeing that I did enter one of the characters in the condition, and move on to cout. Probably a simple mistake, but I thank you in advance.

    Read the article

  • Rails has_and_belongs_to_many relationship question

    - by Kevin Whitaker
    Hello all, I'm sure that this question has been asked somewhere before, as the habtm relationship seems to be very confusing. I have two models, users and promotions. The idea is that a promotion can have many users, and a user can have many promotions. class User < ActiveRecord::Base has_and_belongs_to_many :promotions end class Promotion < ActiveRecord::Base has_and_belongs_to_many :users end I also have a promotions_users table/model, with no id of its own. It references user_id and promotions_id class PromotionsUsers < ActiveRecord::Base end So, how do I add a user to a promotion? I've tried something like this: user = User.find(params[:id]) promotion = Promotion.find(params[:promo_id]) promo = user.promotions.new(promo) This results in the following error: NoMethodError: undefined method `stringify_keys!' for #<Promotion:0x10514d420> If I try this line instead: promo= user.promotions.new(promo.id) I get this error: TypeError: can't dup Fixnum I'm sure that there is a very easy solution to my problem, and I'm just not searching for the solution the right way. Thank you for your time, and any help you can provide.

    Read the article

  • Getting a specific number of JSON items with jQuery from tumblr feed

    - by Kevin Whitaker
    Hello all. I'm trying to populate a page with X entries from my tumblr feed, and I'm wondering how I can only pull that X number from the JSON object it returns. Here's my code, pulled from another Stack Overflow post and modified: //Tumblr retrieval $.getJSON("http://tumblr-address/api/read/json?callback=?", function(data) { $.each(data.posts, function(i,posts){ var title = this["regular-title"]; var type = this.type; var date = this.date; var url = this["url-with-slug"]; $('#sideRail ol').prepend('<li><p><a href=' +url +'>' + title + '</a></p><p>' + date + '</p></li>'); }); }); I've tried using a while loop with a counter, but it just repeats everything X times before moving on to the next item in the list. Thanks for any help.

    Read the article

  • Rails NoMethodError in loop when method exists

    - by Kevin Whitaker
    Good day all. I'm running into a bit of a problem getting a script running on my production environment, even though it works just fine on my dev box. I've verified that all the requisite gems and such are the same version. I should mention that the script is intended to be run with the script/runner command. Here is a super-condensed version of what I'm trying to do, centered around the part that's broken: def currentDeal marketTime = self.convertToTimeZone(Time.new) deal = Deal.find(:first, :conditions = ["start_time ? AND market_id = ? AND published = ?", marketTime, marketTime, self.id, 1]) return deal end markets = Market.find(all) markets.each do |market| deal = market.currentDeal puts deal.subject end Now convertToTimeZone is a method attached to the model. So, this code works just fine on my dev machine, as stated. However, attempting to run it on my production machine results in: undefined method `subject' for nil:NilClass (NoMethodError) If, however, I go into the console on the production box and do this: def currentDeal marketTime = self.convertToTimeZone(Time.new) deal = Deal.find(:first, :conditions = ["start_time ? AND market_id = ? AND published = ?", marketTime, marketTime, self.id, 1]) return deal end market = Market.find(1) deal = market.currentDeal puts deal.subject It returns the correct value, no problem. So what is going on? This is on rails v 2.3.5, on both machines. Thanks for any help

    Read the article

  • PHP: creating a smooth edged circle, image or font?

    - by Chad Whitaker
    I'm making a PHP image script that will create circles at a given radius. I used: <?php imagefilledellipse ( $image, $cx, $cy, $w, $h, $color ); ?> but hate the rough edges it produces. So I was thinking of making or using a circle font that I will output using: <?php imagettftext ( $image, $size, $angle, $x, $y, $color, 'fontfile.ttf', $text ); ?> So that the font will produce a circle that has a smooth edge. My problem is making the "font size" match the "radius size". Any ideas? Or maybe a PHP class that will produce a smooth edge on a circle would be great! Thank you.

    Read the article

  • .htaccess redirect folders

    - by Chad Whitaker
    Hello I have a link on my site with files at the following link: example.com/community/community/ How can I use htaccess to convert the link to example.com/community/ without moving the files from /community/community/

    Read the article

  • Rendering HTML in rails without actually displaying it

    - by Kevin Whitaker
    Hello all, My current project requires me to assemble a .zip file containing HTML and text-only templates for a user to download, for importing into an email marketing program. I've inherited this project, and currently the code uses a "fake" model (that is a model that does not directly correlate to a database table), in which it stores the entire template in a string, using dynamic variables to populate certain areas. The "fake" model then has a method for creating a zip file. It seems to me that there has to be a better way to do this. I was wondering if there was a way to move the template into a .erb/haml file, and then write a method that would populate the file in preparation for being zipped up? Basically, is there a way to render an HTML and text file, without actually having to display them? Thanks for any help.

    Read the article

  • import svn history

    - by Corey Watts
    I had to wipe our svn server, but I failed to "dump" the repositories before installing a new OS. However, I had a complete backup of every file in each repository. I've since transferred all the old files back over. Unfortunately the version history is completely gone. I still have all the old incremental files, and svn can see each revision with the "verify" command, but I'm wondering if it is possible to import the old history directly from the actual files (not a dump file)?

    Read the article

  • Task bar remains visible with "Auto-hide the task bar" checked in Windows 7.

    - by Corey
    It's about time that I figure this out. I can say with a pretty high confidence that I have experienced this issue in all consumer versions of Windows since XP. I keep "Auto-hide the task bar" checked to maximize screen real estate. Every once in a while, the task bar will refuse to hide while individual windows will continue to act as if that option is checked (by falling under the task bar). For years, I have fixed this by rebooting. Of course, I cannot predict the timing or frequency of the problem, so the process becomes burdensome. I want to know how this can be fixed without rebooting. It has affected my on multiple machines using multiple versions of Windows, so I cannot be the only one who is bothered by it. Can anyone help me solve this?

    Read the article

  • Blinking motherboard power LED

    - by Corey D
    I was just rebuilding an old desktop PC to be used as a HTPC and the LED on the motherboard that indicates when there is power is blinking fairly rapidly. The only way I can get the machine to boot is to press the power button immediately after plugging it in, and even then I cannot make it into the BIOS. The power supply has more than enough juice to power all of the components, and is from a reputable manufacturer. The motherboard is an Asus and is about 4.5 years old. Is my power supply hosed? Or is it my motherboard?

    Read the article

< Previous Page | 1 2 3 4 5 6 7  | Next Page >