Home >

mouse move sprite xna c#

  • How to handle mouse input in XNA?May 1

    I am developing a card game in XNA. Is there any OnClick event in XNA for objects? I am trying to make cards move when the player clicks on them. In this project, there is a Sprite class that draws the card, but I am a little stuck because I don't kn

  • Implementing a Custom Mouse Cursor in XNANovember 14

    I have tried making a custom mouse cursor, hiding the real mouse, taking the real mouse delta and clamping it to a maximum speed. Here is the problem: In windowed mode, the "real" mouse cursor moves off the window while the custom mouse cursor (

  • Why does my sprite player move faster when I move the mouse?May 21

    I'm trying to develop a simple game made with Pygame (Python library). I have a sprite object which's the player and I move it using arrow keys. If I don't move the mouse, the sprite moves normally, but when I move the mouse, the sprite moves faster

  • Animating a Sprite After Mouse Release - SFMLAugust 6

    I'm working on a game where the user can drag and release sprites. After the sprite is released it should interpolate (animate) back to its original position. So I researched on the math relevant to implement the concept in the game. To demonstrate m

  • SFML - Moving a sprite on mouseclickNovember 24

    I want to be able to move a sprite from a current location to another based upon where the user clicks in the window. This is the code that I have: #include <SFML/Graphics.hpp> int main() { // Create the main window sf::RenderWindow App(sf::VideoMod

  • How do I get the mouse position relative to the window, not the whole screen?February 20

    I am developing an XNA game. I run it in window mode. I need to handle mouse events, but when I use the Mouse class from Xna.Framework.Input.Mouse, I get the the mouse position on the whole screen. I use this code: MouseState state = Mouse.getState()

  • How can I test if the mouse draw on the active tiles?January 20

    I want to draw some sprites in a tiledmap where the tiles are active. I want to draw with the mouse, so how could I compare the position of the mouse, the sprite position and the position of active tiles? I tried to compare: sprite.getX, screenX and

  • How can I better handle images that I don't need drawn anymore (for now)?June 9

    For minimalist sake, let's say I have an image of a button in a game and on the screen. When you left-click the button, it will disappear. If you right-click (anything), the button will reappear. I'm trying to improve my code, so if you see anything

  • Discrete movements in Phaser

    Discrete movements in PhaserFebruary 24

    What is the best approach to let a Phaser.Sprite do discrete movements? It should continue moving along all possible values, but at the end of a move it must end up on a certain position which will have the following property: position.x % SOME_FIXED

  • XNA Sprite mouse selection with layered/overlapping spritesApril 5

    If I use mouse coordinates to select a sprite does XNA provide a built in way to return the top-most sprite on the screen at a coordinate? I am trying to highlight the selected sprite, but when iterating through my sprites at the specific mouse locat

  • Xna custom mouse not allowing me to move its sprite past certain bounds

    Xna custom mouse not allowing me to move its sprite past certain boundsMarch 1

    I have written a Custom mouse, with a Custom sprite, using MouseState, and getting the X and Y variables. However i also have a camera that i wrote, and this allows me to leave the initial box. One sprite that can freely move this area, but my mouse

  • Moving a sprite in XNA/C#, using vectorsJanuary 26

    I'm currently looking into XNA game development with the C# language. I have two classes: the main game handler and a "sprite" class. Following is some basic pseudo-code which I hope adequately describes the issue. Game.cs class game { sprite th

  • What is the best practice to move sprites using mouse order in Tile games?March 6

    I am trying to make my first Tile-game using XNA. I have no problem drawing the map layers using TiledLib from codeplex, but, now I want to give sprite an (order) to move to a specific position on map, by selecting the sprite (left mouse click) and t

  • Xna winform scaling and mouse positionJuly 15

    I am attempting to create a simple 2d level editor using xna and winforms. I have used the app hub win form samples as a starting point. At first I was having trouble with the mouse coordinates but after setting the mouse handle to the control, it is

  • XNA How to detect collision between 2d sprites and 3d primitives (not models)August 15

    My current status I have already read some tutorials about 3d collision. I know how ray trace works and how to convert mouse follow a vector to track the closest object that collides with out vector I have also worked with 2d collisions before and I'

  • C#/XNA get hardware mouse positionDecember 13

    I'm using C# and trying to get hardware mouse position. First thing I tryed was simple XNA functionality that is simple to use Vector2 position = new Vector2(Mouse.GetState().X, Mouse.GetState().Y); After that i do the drawing of mouse as well, and c

  • C# XNA Weird black line behaviour of sprite animation spriteBatch.Draw()October 24

    So I've been making a Space Invaders game in XNA. I have my ship spritesheet (sprites are left-to-right - horizontal). The spritesheet has 6 sprites. Here's my class: playerShip.cs using System; using System.Collections; using System.Collections.Gene

  • How to rotate "stacked sprites" in XNA?October 12

    I'm working on a simple Sinistar-style shooter in XNA, and I'm constantly running into trouble with transformations. I feel like I'll get it eventually, but this problem is really bending my mind. My little ship has two states: idle and engines-firin

  • XNA Required information to represent 2D Sprite graphicallyDecember 9

    I was thinking about dividing my game engine into 2 threads: render thread and update thread (I can't come up on how to divide update thread from physic thread at the moment). That said, I have to duplicate all Sprite informations, what do I really n

  • How do I disable texture filtering for sprite scaling in XNA 4.0?December 26

    I have a sprite that I'm trying to scale up in XNA, but XNA is applying some sort of texture filtering that smooths it and makes it look ugly. I'd like it to just do pixel doubling instead of interpolation. How would I accomplish that? --------------

Copyright (C) 2018 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 11 q. 0.576 s.