myGully.com Boerse.SH - BOERSE.AM - BOERSE.IO - BOERSE.IM Boerse.BZ .TO Nachfolger
Zurück   myGully.com > Computer & Technik > Programmierung
Seite neu laden

C#&XNA - Scrolling Background

Willkommen

myGully

Links

Forum

 
 
 
Themen-Optionen Ansicht
Prev Vorheriger Beitrag   Nächster Beitrag Next
Ungelesen 15.06.12, 13:44   #1
ipulf2
Anfänger
 
Benutzerbild von ipulf2
 
Registriert seit: Mar 2012
Beiträge: 42
Bedankt: 1
ipulf2 ist noch neu hier! | 0 Respekt Punkte
Standard C#&XNA - Scrolling Background

Hallo Leute^^

Ich Programmiere momentan ein kleines Jump&Run-Spiel und komme nicht weiter^^

Ich habe einen ScrollingBackground eingebaut, der allerdings durchgehend scrollt^^

Jetzt möchte ich wissen wie ich denn machen kann das ich nur scrolle wenn ich eine bestimmte entfernung zum Bildschirmrand habe^^

Hier mein Quellcode:

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace WindowsGame1
{
    class Backgrounds
    {

        public Texture2D texture;
        public Rectangle rectangle;

        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(texture, rectangle, Color.White);
        }

        
    }
    class Scrolling : Backgrounds
    {
        public Scrolling(Texture2D newTexture, Rectangle newRectangle)
        {
            texture = newTexture;
            rectangle = newRectangle;
        }
        public void Update()
        public void Update()
        {
                rectangle.X -= 3;
        }
    }
}
Wäre cool wenn ihr mir helfen könntet, ich habe nicht viel Ahnung von dem Zeug^^

MfG ipulf2
ipulf2 ist offline   Mit Zitat antworten
 


Forumregeln
Du kannst keine neue Themen eröffnen
Du kannst keine Antworten verfassen
Du kannst keine Anhänge posten
Du kannst nicht deine Beiträge editieren

BB code is An
Smileys sind An.
[IMG] Code ist An.
HTML-Code ist Aus.

Gehe zu


Alle Zeitangaben in WEZ +1. Es ist jetzt 22:18 Uhr.


Sitemap

().