Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Microsoft.Xna.Framework.Content;
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Graphics;
- using Microsoft.Xna.Framework.Input;
- namespace screenchange
- {
- class Screentwo
- {
- ContentManager Content;
- Vector2 ScreenSize;
- Texture2D background2,mousearrow,left,main;
- Rectangle leftRectangle;
- Vector2 spriteOrigin;
- Vector2 spritePosition;
- Texture2D fruit1, fruit2, fruit3, fruit4, fruit5;
- int MainPosX = 100,MainPosY = 600;
- int fallPosX = 800, fallPosY = 50;
- bool DoneRunning = false;
- bool FallingSeed = false;
- bool Bloom1 = false;
- bool Bloom2 = false;
- bool Bloom3 = false;
- bool Bloom4 = false;
- bool Bloom5 = false;
- Rectangle rectFruit1, rectFruit2, rectFruit3, rectFruit4, rectFruit5;
- float rotation;
- public bool change = false;
- public Screentwo(ContentManager content, Vector2 screensize)
- {
- Content = content;
- ScreenSize = screensize;
- LoadContent();
- }
- public void LoadContent()
- {
- background2 = Content.Load<Texture2D>("background2");
- mousearrow = Content.Load<Texture2D>("mousearrow");
- main = Content.Load<Texture2D>("main");
- fruit1 = Content.Load<Texture2D>("fruit");
- fruit2 = Content.Load<Texture2D>("fruit");
- fruit3 = Content.Load<Texture2D>("fruit");
- fruit4 = Content.Load<Texture2D>("fruit");
- fruit5 = Content.Load<Texture2D>("fruit");
- spritePosition = new Vector2(300, 250);
- }
- public void Update(GameTime gametime)
- {
- //leftRectangle = new Rectangle((int)spritePosition.X, (int)spritePosition.Y, left.Width, left.Height);
- //spriteOrigin = new Vector2(leftRectangle.Width/2, leftRectangle.Height/2);
- if(MainPosX < 600)
- {
- MainPosX += 3;
- } //Scene2 opening
- else
- {
- MainPosX = 600;
- DoneRunning = true;
- }
- Rectangle mouseRec = new Rectangle(Mouse.GetState().X, Mouse.GetState().Y, 50, 50);//size+position
- rectFruit1 = new Rectangle( 911, 300, 111, 120);
- rectFruit2 = new Rectangle( 1000, 250, 111, 120);
- rectFruit3 = new Rectangle( 700, 200, 111, 120);
- rectFruit4 = new Rectangle( 780, 150, 111, 120);
- rectFruit5 = new Rectangle( 800, 100, 111, 120);
- if (Mouse.GetState().LeftButton == ButtonState.Pressed)
- {
- if (mouseRec.Intersects(rectFruit1))
- {
- System.Threading.Thread.Sleep(100);
- Bloom1 = true;
- }
- if (mouseRec.Intersects(rectFruit2))
- {
- System.Threading.Thread.Sleep(100);
- Bloom2 = true;
- }
- if (mouseRec.Intersects(rectFruit3))
- {
- System.Threading.Thread.Sleep(100);
- Bloom3 = true;
- }
- if (mouseRec.Intersects(rectFruit4))
- {
- System.Threading.Thread.Sleep(100);
- Bloom4 = true;
- }
- if (mouseRec.Intersects(rectFruit5))
- {
- System.Threading.Thread.Sleep(100);
- Bloom5 = true;
- }
- if(Bloom1 && Bloom2 && Bloom3 && Bloom4 && Bloom5)
- {
- FallingSeed = true;
- }
- } //Condition before Seed falling
- if (DoneRunning && FallingSeed)
- {
- if (fallPosY < 600)
- {
- fallPosY += 10;
- }
- else
- {
- fallPosY = 600;
- }
- } //Seed Falling
- }
- public void Draw(SpriteBatch spriteBatch)
- {
- spriteBatch.Draw(background2, new Rectangle(0, 0, 1420, 780), Color.White);
- //spriteBatch.Draw(left, spritePosition, null, Color.White,rotation,spriteOrigin,1f,SpriteEffects.None,0);
- spriteBatch.Draw(main, new Rectangle(MainPosX, MainPosY, 100, 102), Color.White);
- if (DoneRunning && FallingSeed)
- {
- spriteBatch.Draw(main, new Rectangle(fallPosX, fallPosY, 100, 102), Color.White);
- }
- spriteBatch.Draw(fruit1, new Rectangle(911, 300, 111, 120), Color.White);
- spriteBatch.Draw(fruit2, new Rectangle(1000, 250, 111, 120), Color.White);
- spriteBatch.Draw(fruit3, new Rectangle(700, 200, 111, 120), Color.White);
- spriteBatch.Draw(fruit4, new Rectangle(780, 150, 111, 120), Color.White);
- spriteBatch.Draw(fruit5, new Rectangle(800, 100, 111, 120), Color.White);
- spriteBatch.Draw(mousearrow, new Rectangle(Mouse.GetState().X, Mouse.GetState().Y, 50, 50), Color.White);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement