Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8658753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:50:40+00:00 2026-06-12T15:50:40+00:00

Sorry if the title is a little… vague. Anyway, I’m making a platformer using

  • 0

Sorry if the title is a little… vague. Anyway, I’m making a platformer using java and I’ve been trying to create a pressure plate triggered dispenser that shoots poisoned darts. The game is pretty much split up into a grid system, with each block being a spot on the grid. so far I’ve made it so that when the pressure plate is activated, it looks as if it’s pressed down. I’ve also been able to draw it to the screen but it does not move or anything. This is the code I use to draw it to the screen:

public void drawDart(Graphics g) {
    if(Component.isPressed) {
        for(int x = 0; x < block[0].length; x++) {
            for (int y=0; y < block[0].length; y++) {
                if(x == 91 && y == 35) {
                    block[x][y] = new Block(new Rectangle(x * Tile.tileSize, y * Tile.tileSize, Tile.tileSize, Tile.tileSize), Tile.poisonDart); 
                }
            }
        }
    }
}

Unfortunately, with this code when I step on the pressure plate, the dart is drawn, but will not move. I’ve tried using x++ before but that doesn’t move the dart at all.

Another problem is that I would like the dart to look like it’s affected by gravity, which is hard to do when the game is split into a large grid system. Either way, what do you guys think?

Moderator edit (moved from OP comment):

block[x][y] = new Block(new Rectangle(x * Tile.tileSize, y * Tile.tileSize,
    Tile.tileSize, Tile.tileSize), Tile.poisonDart); 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T15:50:41+00:00Added an answer on June 12, 2026 at 3:50 pm

    Have you implemented the “game loop” for your game? It looks like this (pseudo code):

    while (gameRunning) {
      for (GameEntity e in gameWorldEntities) {
        e.update(timePassed);  
      }
      for (GameEntity e in gameWorldEntities) {
        e.draw();
      }
    }
    

    Each dart object should know its position in the game world, and the Dart class’s update() method should update its position, including moving it horizontally if it’s been launched and making it fall due to gravity. Keeping track of its horizontal and vertical velocity is a good idea unless you are using a separate physics engine, which it sounds like you’re not. Then the draw() method just needs to draw it on the screen in the right place.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry if the Title is a little vague but the truth is I do
Sorry if the title is a little vague, I do not know how else
sorry if the title is a little.. vague i couldnt pin it down. So
Sorry if the title is a little vague, I have the following sceneraio: I
Using MS Access. I'm sorry that the title is vague--i just don't exactly know
Sorry if the title is a little confusing. What I'm doing is creating a
Sorry if the post title wasn't clear, I will try to explain a little
I'm sorry if my title is a little unclear. Basically I want to print
I understand the title may be a little vague, but, hopefully, I can explain
So I'm sorry the title is so vague I'm not really even sure how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.