Tomm Schuman

Greenhorn
+ Follow
since Mar 04, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Tomm Schuman

I still have the same problem i always had when the players collide they get stuck and can't move. The problem is that they can move from 0-8 pixels in one direction because i have 360� movement. It would be easier if it always was 1 pixel. Any suggestions about how i should change my code?

Here is my code
19 years ago
I'm doing collission detection to my game.
I already have bounding boxes and the game checks if they intersects.
But my problem is how do i get the player stop when the boxes intersect.
I have been trying to do it without success.
The movement of the player goes like this.

Could someone help me?
19 years ago
But I am using double buffering, how should i add triple buffering?
19 years ago
I am making a game.
You can try what i have done so far here

But i have some problems about flickering in the game.
First one is when the frames of the player are drawn the first time it flickers alot. I have no idea why it does that because i load all the images when the game starts.

Then the other problem is when I draw the background which consists of many 20X20 pictures. If i have the game like 500x500 it works good but if i have it 1000x1000 it flickers in the lower right corner. Here is the code i use to paint the background:


I use this for painting:

Is there something wrong in painting this way. I have modified my game from a pacman tutorial which had painting done this way.
19 years ago
I hope this is the right forum to ask this.

I have a applet where i want to paint an image from a file.
If the file is gif it works but not bmp. Why??

First i initialize an Image object:


Then i get the image:


And last i draw it:


That wont paint anything but if I use the North.gif file I also have it will paint the image
19 years ago
I have a problem in the movement in my game.
I want it so that when the left key is pressed the player turns left and when the right key is pressed the player turns right. Then when the up key is pressed the player moves in the direction he's heading and when the down key is pressed the player moves the opposite way.

Here is the you see how the game is now:Game

Is there anyway to make it possible to see the console from a webpage? Because I have some println statements which print out different values from the calculation. It could be easier to see whats wrong if you see them.

Here is the code I use to calculate the x and y cordinates based on the way the player is heading. The problem is somewhere in the if statements because the player will move 90 degrees okay but then the player moves very weird and starts another 90 degree turn. So please could someone help me making this work.

You can download the full source code here



[ March 12, 2005: Message edited by: Tomm Schuman ]

[ March 12, 2005: Message edited by: Tomm Schuman ]
[ March 12, 2005: Message edited by: Tomm Schuman ]
19 years ago
O there was already a method which does that

I have had sin,cos,tan in school but I don't really know how to use them in programming. Could someone give me an example about how you calculate the X in the triangle below.

19 years ago
Why does the code below print 1.0 if heading is 50? The real answer is 1.8
Rad is a double and heading an int.

I'm trying to convert degrees to rad, tell me if there's a better way to do it than the one i use. Thx in advance

19 years ago
YAY!! IT WORKED

The problem was here:



I changed it to if (allDone == true) then the thread worked but i could only run it once. Then made Thread = null and it worked

Here is the code i use now. Could someone check it if I could do something better. Especially the synchronized methods because I have no idea if i put them to the right places.
Well this is the third time I ask this question, this time I try give you enough information and I have also read from the beginning of the java tutorial on sun's website to the lesson about threads. In my last post you said i should read about event listeners but i don't believe the problem is in there.

I want an Integer to rise by 1 every second while I have left arrow button pressed and then stop rising when I relase it. I tried somehow make an inner class which would be the tread which starts and stops when I press and relase the left arrow button.

But when I run the program (I have a println method which shows the value of heading360) it first prints out 2's, then when I press left arrow it prints 0's for like 1 sec and then prints 1's till I end the program. I believe the problem is that I don't really undertand how threads work. I read from the tutorial but I couldn't use the examples for this.

Below is the code I'm using. I have removed parts of the code. I'll post more if I have forgot to write a part you need to see.

You can download the whole source code here:Killers.java


[ March 09, 2005: Message edited by: Tomm Schuman ]
[ March 09, 2005: Message edited by: Tomm Schuman ]
Is there any way to make the applets background transparent so that you would see the html page behind it? But so that you would still see images,buttons and text.

Thx in advance
19 years ago