# Pyro Sauce

Member

348

• #### Last visited

• Rank
Mithril Member
• Birthday 12/05/1993
1. ## Entities colliding problem

k well i didn't read your post at all but I'm gonna post anyway cos that's just how I roll. [CODE]public abstract class Entity{ //blah blah code blah blahblah Rectangle me = new Rectangle(x,y,width,height); //blah blah more code blah blah public Rectangle getBounds(){ return me; } public boolean isColliding(Entity other){ Rectangle him = new Rectangle(other.getBounds()); return me.intersects(him); } }[/CODE] if you are dealing with circles then collision detection is just a matter of checking if any part of anything is closer than the radius to the center of said circle... if i didn't answer your question bitch at me and I'll come back and read your post then complain about how i have no idea what your talking about then you can promptly explain yourself further and I'll try my best to help.
2. ## Collision detection help

[quote name='Steve']You could use the rectangle class and have a rectangle for the entity's bounds, and check if it intersects a bullet. Or create your own implementation of it, which would go along the lines of b.x == n.x && b.y == n.y[/QUOTE] yeah but how would i check if if ANY npc was colliding with ANY bullet? that would take way to long with my current method, yet i always see people doing collision detection like this, hell even mario did this without trouble. The way im thinking about it is I would do something like: [code] Projectile bullet[20] = new Projectile[20]; NPC n[] = new NPC[20]; for(blah){ spawn npcs based on grid } main loop{ for(blah){ //update bullet[i] if bullet[i].isActive is true if(bullet[i].isActive){ bullet[i].update(); } } for(blah){ npc[i].update(); } p.move(); if(mapNeedsUpdating){ map.update(); } repaint(); } [/code] then in bullet I would have something like [code] if(isActive) for(blah){ check if I'm colliding with npc[i]; if i am, destroy the npc and me } else move me over one [/code] so i have a feeling that that would be EXTREMELY inefecient. If i had all 20 bullets on screen, they would EACH check if they were colliding with ANY npc every time they moved at all(so that's 20 loops each containing 20 loops plus the player updating and the map updating and the npc updating and the drawing all that stuff). but idk how im supposed to do it if i cant do that method...
3. ## Collision detection help

The problem: I have up to 20 ish npcs and 20 ish projectiles on screen at a time; how do i check for collisions between any of them? Some info: I'm extremely inexpierenced in the game dev world and i only just figured out a haxy way to make and draw a tile map platformer. My current 'collision detection' is literally just having player only add x_speed to xpixelposition if Main.map.getMapArray[ytile][xtile+ 1] is greater then 2(cos 0 1 2 are all unwalkable). The same thing goes for projectile(even same var names)
4. ## Codingbat Java logic 2 - makeBricks

[quote name='Trey'][code] public boolean makeBricks(int small, int big, int goal) { return small + (big * 5) < goal ? false : (goal % 5) <= small; } [/code] Would be sufficient. First, you need to check for is if you have enough length using all of the bricks. If that's true, then you need to check if you have enough small bricks left after using enough big ones. Once you get through a good chunk of the codingbat problems, I recommend checking out project Euler. It's an even better programming/math problem site that allows you to use whatever language or tools you wish.[/QUOTE] Trey, first of all, your my freakin' hero :P and second, I'm curious... how did you come to know all that you do about programming? I've taken a couple classes so far but I still know very little about computer science/ programming over all, and every time I try to learn from wikipedia or something I find that I just confuse myself. I'm probably just getting too far ahead of myself but I really want to know more and there's no higher classes I can take on this until I go off to college.
5. ## Codingbat Java logic 2 - makeBricks

Can someone please explain to me why this is wrong? [CODE]public boolean makeBricks(int small, int big, int goal) { int inch = big*5; if(goal >= inch) return(goal-inch <= small); else return(small >= goal || (goal-small)%5 == 0); }[/CODE] the problem can be found at [url]http://codingbat.com/prob/p183562[/url]
6. ## Java Pickin' Sticks

@Trey - Thanks so much for all the help @Ramsin - If you're not gonna bother TRYING to THINK about helping then don't bother posting on my threads EVER. @mumups - Go home Freshman. @ Any mod / admin - please close this, I am no longer in need of assistance and I'm damn sure the only people who will post more on this will be people who are trying to impress trey or just trying to get thanks on their posts by saying useless shit that people will agree with such as - "this f*g has probably never heard of javadocs" or "you couldnt find game dev tuts because your stupid" and stuff like that.
7. ## Jar + Sign help

guys it's fine nevermid, i managed to find the underlying problem. to the people who posted: yes it is a PI and it is also a 317 revision. sorry to have kinda wasted your time with this I hope there's no hard feelings =x
8. ## Jar + Sign help

Okay guys, normally I would be able to make a simple webclient myself but I can't seem to do it at the moment and I'm just wondering if anyone can help me just jar and sign my client and maybe do more than that if needed.
9. ## Webclient Services !

I need to talk with you some more about the webclient.. but that can wait till tomorrow
10. ## Webclient Services !

I will take 1 webclient pl0x0rz
11. ## which home is the best

I like catherby because it's so nice and close to the water. plus it's waay easy to start off skilling from there
12. ## Coder + Help Getting Server Online

Why not just join someone else's server at this point? You're not even bothering to make or edit the server yourself, and so you are essentially playing someone else's server and just requesting updates you want to see....
13. ## [RSPS] Programming Services

Hey Emily, I'd like to talk with you about making a working webclient for my server along with getting skillcapes to acutally work and perhaps re-writing a few skills (mainly farming, firemaking, and cooking) could you add me on msn? my email for it is [email][email protected][/email]
14. ## [PI/DSPK]In need of a hoster & semi coder.

My msn aim and skype are all under my profile pic in my posts =P
15. ## [PI/DSPK]In need of a hoster & semi coder.

I can be your 'semicoder' if you want. I've worked with PI before and I know enough Java to get me around.
×
• Home

• RSPS List

• Clubs