• 10
• 10
• 12
• 12
• 14
• ### Similar Content

• By Fritz1
QuizTime.live is a new quiz platform, a collection of skill games where you can win a LOT of money!
The games are played in real time, with 1, 2, 3, 4 or 5 players.
At special times there are tourneys, with an unlimited number of participants.
The prize money depends on the number of players.

• So i am working on a java swing breakout game and am on the last task to complete, which is detecting collision with a brick and then deleting it from the array so it cannot be seen on the screen. I have created a for loop which is somewhat working however the ball bounces off the bat/paddle and goes straight through the first few rows of bricks and then start to detect only the rows around the 6/7th row. Here is the loop i am working on.
public void runAsSeparateThread() { final float S = 3; // Units to move (Speed) try { synchronized ( Model.class ) // Make thread safe { GameObj ball = getBall(); // Ball in game GameObj bat = getBat(); // Bat ArrayList<GameObj> bricks = getBricks(); // Bricks } while (runGame) { synchronized ( Model.class ) // Make thread safe { float x = ball.getX(); // Current x,y position float y = ball.getY(); // Deal with possible edge of board hit if (x >= W - B - BALL_SIZE) ball.changeDirectionX(); if (x <= 0 + B ) ball.changeDirectionX(); if (y >= H - B - BALL_SIZE) // Bottom { ball.changeDirectionY(); addToScore( HIT_BOTTOM ); } if (y <= 0 + M ) ball.changeDirectionY(); // As only a hit on the bat/ball is detected it is // assumed to be on the top or bottom of the object. // A hit on the left or right of the object // has an interesting affect boolean hit = false; // *[3]******************************************************[3]* // * Fill in code to check if a visible brick has been hit * // * The ball has no effect on an invisible brick * // ************************************************************** for ( int i = 0; i <= 60; i++ ){ GameObj brick1 = bricks.get(i); if ( brick1.hitBy(ball) ){ bricks.remove(i); //hit = true; ball.changeDirectionY(); //ball.changeDirectionX(); addToScore(50); } } if (hit) ball.changeDirectionY(); if ( ball.hitBy(bat) ) ball.changeDirectionY(); } modelChanged(); // Model changed refresh screen Thread.sleep( fast ? 2 : 20 ); ball.moveX(S); ball.moveY(S); } } catch (Exception e) { Debug.error("Model.runAsSeparateThread - Error\n%s", e.getMessage() ); } } } i need to be able to break each brick individually and for them to rebound ... this is the code that i am working with so far
for ( int i = 0; i <= 60; i++ ){ GameObj brick1 = bricks.get(i); if ( brick1.hitBy(ball) ){ bricks.remove(i); //hit = true; ball.changeDirectionY(); //ball.changeDirectionX(); addToScore(50); } }

• Hi guys!
This is a independent game being produced by me and my brother. We’ve been working on it for about 6 months and we’ve already done a good part of the game. We hope to finalize and make it available on Steam by the end of this year.
We are using Blender 3D and Gimp software for production.

About the Game: Dongo Adventure will be a 3D platform style game, where the main character (Dongo) is a mouse that ventures through various scenarios (sewers, culverts, streets, electric grid, etc.) and faces several enemies along the way (cockroaches, mosquitoes, spiders, toxic gases, electrical wires, etc.). He carries a basket / backpack with cheeses that he uses to throw and defend himself from enemies, as well as being able to push objects that helps him to overcome obstacles. The ultimate goal will be a surprise!

Now we are developing new scenarios and enemies. We hope to publish news soon...
Game page on Steam: http://store.steampowered.com/app/811450/Dongo_Adventure/ - (Teaser UPDATED)

Thanks for following the project!

• This is a general question about player controller on a surface that contains geometry (curved roads / slopes, mountains, etc.) and obstacles (walls). The game should simulate a simple physical model (acceleration, collisions, etc.) and the character should navigate convincingly through the terrain.

I'm using Unity but I think this is a general question about how to design a character controller.

I wrote a simple character controller that uses player input to steer the character in the world. wasd keys move forward and turn. Since I'm controlling the character directly, I'm using a kinematic object (I don't even use the rigidbody) and moves it by setting the transform directly to some model I implemented (I have speed, acceleration, mass, etc.)

Why did I wrote a physical kinematic simulation? I tried to use a rigidbody and apply forces based on player's input directly on it but I found the control felt a little bit "swimmy" and it was hard to tweak (example: the character slammed hard and spun out of control (even when locking xz rotating direction), it took a long time to accelerate, etc.)

That worked well when during prototyping on a simple plane with no obstacles. Now I have a level with non-even geometry. The problem I have is how to make the players "stick" to the ground when they travel around (Prototype applies movement on the xz plane but doesn't take into account being connected to the floor). Another issue is to set the orientation (up vector) of the player (imagine a vehicle) in a way that looks both smooth and convincing - the vehicle should change its pitch / roll as it's navigating through some slopes. Even the simple example of a  vehicle starting to climb from a plane on a road with a constant slop (say 20 deg) should change the orientation in a convincing manner, i.e. the vehicle should not start to "lift the nose" before touching the ramp, nor should it "sink the nose" colliding into the ramp. Again, this is where the physical engine can come in handy, but when I tried to apply force going up the vehicle slowed down because of friction.

I also have problems with collisions since I'm moving the character directly by controlling its transform (kinematic), it feels weird and doesn't play well when the physics engine detects collisions and doesn't want to let the character penetrate a wall. It collides well with objects, it just feel very not natural.

The real questions here are about best approaches to design a character controller (note: that SHOULD be applied also to agents using AI steering algorithms - that also calculates forces or running a model underneath).

1. How do you move a character? Are you using the physics engine to do the heavy lifting or you control the character directly like a kinematic object?
2. If you're using physics, what's the best approach to apply forces? (yes, it depends on the game, but let's say some realistic based physics model with accelerations and forces - let's assume animations don't apply root motion - to simplify) In Unity, there are multiple ways to apply force - relative / non-relative, impulse / continuous etc.
3, If you're not using physics, how do you make sure that collision detection play nice with your movement algorithms? How do you make collisions look natural and still give the player good control?
4. Uneven terrain, how do you make the character (let's assume a vehicle - a car - with no complex animations (so no IK in play)) "stick" to the ground while changing its orientation (up vector) in a smooth and convincing manner?
5. what's the best way to also allow the player to disconnect from the ground? (e.g. either jump or fall off platforms)

For me, rigidbody vs. kinematic is the key question here. I saw tutorials that use both - but since they were super simple they didn't deal with the problems I mentioned above in depth. I'm wondering what's the best approach for the player controller and would love to hear more points to consider and tips based on your experience. Pseudo code / code samples (in any language / engine) would be much appreciated. Thank you!

• Hi guys,
I just released my first game and would like to know if anyone wants to test it. This is the first attempt to produce a game. A total new world for me.

I hope you like and have fun. Any feedback will be appreciated.

Kind regards,

Steamie & Tilted

# how to repaint a point in snake game :(

## Recommended Posts

i have a prolem with my first game that i can't re paint a point after the snake ate. Can you resolve my problem

i use an array 2D to draw map, 2 arrays to draw snake and an array 2D to draw food. But i can't make the food disapear when the snake meet food and draw a new food  Please help me or give me an idea. i also want add another map in the future or some of food like poison for the snake.

Controller.txt

Food.txt

GameScreen.txt

Main.txt

MapNoWall.txt

Snake.txt

##### Share on other sites

I don't use the same language you use, so I might be mistaken, but it looks like you have two separate Foods.

You have one inside Snake:

public class Snake {

static int GO_UP = 1;
static int GO_DOWN = -1;
static int GO_LEFT = 2;
static int GO_RIGHT = -2;

int vector = Snake.GO_DOWN;
Food food; //<<------

And you have one inside GameScreen:

public class GameScreen extends JPanel implements Runnable{
private static final long serialVersionUID = 1L;
static int weightpanel = 650;
static int heightpanel = 650;
Controller controller;
MapNoWall map;
Snake snake;
Food food; //<<-----

The one inside GameScreen is the one you are drawing. The one inside Snake is the one you are erasing. These are two separate copies (called "instances") of the Food class, and if you change one, it's not going to change the other, they are two different copies / instances.

Snake should not own the food - what you need to do is somehow give Snake temporary access to GameScreen's 'food' variable only during the 'Snake.update()' function, by passing GameScreen's food into the Snake.update() as a parameter. However! It has to be passed by reference (temporarily sharing a single instance), not passed by value (copying the instance is not what you want), and since I don't know your language, I can't tell you exactly how to do that - perhaps someone else knows, or you can google "<your language name> pass by reference" and learn about it. It's possible your language passes function parameters by reference by default.

##### Share on other sites
1 hour ago, Servant of the Lord said:

I don't use the same language you use, so I might be mistaken, but it looks like you have two separate Foods.

You have one inside Snake:


public class Snake {

static int GO_UP = 1;
static int GO_DOWN = -1;
static int GO_LEFT = 2;
static int GO_RIGHT = -2;

int vector = Snake.GO_DOWN;
Food food; //<<------

And you have one inside GameScreen:


public class GameScreen extends JPanel implements Runnable{
private static final long serialVersionUID = 1L;
static int weightpanel = 650;
static int heightpanel = 650;
Controller controller;
MapNoWall map;
Snake snake;
Food food; //<<-----

The one inside GameScreen is the one you are drawing. The one inside Snake is the one you are erasing. These are two separate copies (called "instances") of the Food class, and if you change one, it's not going to change the other, they are two different copies / instances.

Snake should not own the food - what you need to do is somehow give Snake temporary access to GameScreen's 'food' variable only during the 'Snake.update()' function, by passing GameScreen's food into the Snake.update() as a parameter. However! It has to be passed by reference (temporarily sharing a single instance), not passed by value (copying the instance is not what you want), and since I don't know your language, I can't tell you exactly how to do that - perhaps someone else knows, or you can google "<your language name> pass by reference" and learn about it. It's possible your language passes function parameters by reference by default.

thanks for your help, i will apply this. If i success i will post in this post