Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - terrifiedobama

Pages: [1]
1
Finally fixed it
 ;D ;D ;D
jesus those pointers were hard to understand now finally I realise my mistake

2
Okay new update .. Nothing has been fixed the error is gone, but it still doesn't work  :'( :'(

3
Okay guys I somewhat fixed the issue with the pointer
BUT NOW A NEW ERROR CAME
what in the world is this ??????

4
General / Hello guys I've some Errors no clue where the problem is.
« on: July 26, 2019, 02:36:20 pm »
So basically its hard for me to understand here is the video where I speak about the problem
i'll be very happy if you could help me.  :)
https://www.youtube.com/watch?v=UV7MZIxSxIc&feature=youtu.be

5
General / Re: How do i display a winner message?
« on: June 29, 2019, 02:25:32 pm »
Do you have skype or something we could contact and see if i could help.

6
General / Re: How do i display a winner message?
« on: June 28, 2019, 11:13:20 pm »
Okay this is what i could invent
its basic and stupid but it also work i guess

7
General / Re: My window crash
« on: June 28, 2019, 11:06:09 pm »
finally managed to create a crazy collision lol.

#include "GameScreen.h"
#include "Collision.h"
#include <iostream>



GameScreen::GameScreen()
{
   
}


GameScreen::~GameScreen()
{

}

void GameScreen::LoadContent() {

   if (!font.loadFromFile("Font4.ttf"))
      std::cout << " no font found" << std::endl;

   text.setString("Press F1 To go to back");
   text.setFont(font);

   PlayerTexture.loadFromFile("player.png");
   PlayerSprite.setTexture(PlayerTexture);
   PlayerSprite.setPosition(sf::Vector2f(500, 275));
   PlayerSprite.setScale(sf::Vector2f(2, 2));


   //camera ?
   //sf::View Camera(sf::Vector2f(400.f, 300.f), sf::Vector2f(400.f, 300.f));
   //sf::Sprite* follow = &PlayerSprite;

   




   Tile001Texture.loadFromFile("tile001.png");
   //Tile001Sprite.setTextureRect(sf::IntRect(33, 30, 30, 30));
   Tile001Sprite.setTexture(Tile001Texture);
   
   //Tile001Rect.intersects
   Tile001Sprite.setPosition(sf::Vector2f(445,600));
   Tile001Sprite.setScale(sf::Vector2f(2,2));
   

   if (playpos == true) {
      PlayerSprite.setPosition(sf::Vector2f(33, 33));

   }
   
   
      
   
   


   
   
   

}



void GameScreen::UnloadContent() {

}

void GameScreen::Update() {
   if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
   {
      // left key is pressed: move our character
      //std::cout << "Player right" << std::endl;
      PlayerSprite.setTextureRect(sf::IntRect(52, 0, -53, 98));
      PlayerSprite.move(3.1, 0.0);
   }
   if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
   {
      // left key is pressed: move our character
      //std::cout << "Player  left" << std::endl;
      PlayerSprite.setTextureRect(sf::IntRect(0, 0, 53, 98));
      PlayerSprite.move(-3.1, 0.0);
   }

   

      if (sf::Keyboard::isKeyPressed(sf::Keyboard::LAlt))
      {
         //playpos = true;
         //PlayerSprite.setTextureRect(sf::IntRect(0, 0, 53, 98));
         //if (playpos == true)
            PlayerSprite.move(sf::Vector2f(0, -10));

         

         

         //comment teleport
         //if (PlayerSprite.getPosition().y) {
         //   PlayerSprite.setPosition(0, 0);
         //   PlayerSprite.move(sf::Vector2f(0,-1));
         //  }
         //comment no out fly y+
         //else PlayerSprite.move(sf::Vector2f(0, 1));
         //if (PlayerSprite.getPosition().y) {
            //PlayerSprite.setPosition(PlayerSprite);
               //}



      }
   
      // gravity
      if (gravity == true) {


         for (int t = 0;t <= 5;t++) {

            PlayerSprite.move(sf::Vector2f(0, 0.3));


         }

      }

      else
         PlayerSprite.move(sf::Vector2f(0, 0));

   xposplayer = PlayerSprite.getPosition().x;
   yposplayer = PlayerSprite.getPosition().y;
   xpostile001 = Tile001Sprite.getPosition().x;
   ypostile001 = Tile001Sprite.getPosition().y;
   xvel = 0;
   yvel = 0;
   //if (xsetposplayer == true) {

   //   PlayerSprite.setPosition(PlayerSprite.getPosition());
      
   //}
   

   if (PlayerSprite.getGlobalBounds().intersects(Tile001Sprite.getGlobalBounds())) {
      std::cout << "good job fool" << std::endl;
      
      
      PlayerSprite.move(sf::Vector2f(0,0));
      gravity = false;

      //if (xpostile001&&xposplayer) {
      //   PlayerSprite.move() = Tile001Sprite.move();
      //   std::cout << "1" << std::endl;
      //   xsetposplayer = true;
      //   if (sf::Keyboard::isKeyPressed(sf::Keyboard::End)) {
            //xposplayer = 66;
            
      //   }
      //}
      //else if (!xpostile001 && xposplayer) {
      //   xsetposplayer = false;
      //   std::cout << "2" << std::endl;
         
      //}
   }
   else
   {
      
      gravity = true;
      std::cout << "no" << std::endl;
   }

   
   
   
   // coll 2 with bug
   //if (Collision::PixelPerfectTest(PlayerSprite,Tile001Sprite)) {
   //   std::cout << "im idiot" << std::endl;
   //}
   //else
   //{
   //   std::cout << "no col" << std::endl;
   //}
   


}

void GameScreen::Draw(sf::RenderWindow& Window) {
   Window.draw(text);
   Window.draw(PlayerSprite);
   Window.draw(Tile001Sprite);
   Window.setFramerateLimit(60);

   
   
   
}


8
General / Re: My window crash
« on: June 28, 2019, 06:07:58 pm »
yep changed it with for
but still i couldnt manage to collide this position thingy

9
General / Fixed
« on: June 28, 2019, 01:39:12 pm »
So basically in the following picture there is an visual explanation for the problem which is occuring right when the action takes place.

((((The Code))))


#include "GameScreen.h"
#include "Collision.h"
#include <iostream>



GameScreen::GameScreen()
{
   
}


GameScreen::~GameScreen()
{

}

void GameScreen::LoadContent() {

   if (!font.loadFromFile("Font4.ttf"))
      std::cout << " no font found" << std::endl;

   text.setString("Press F1 To go to back");
   text.setFont(font);

   PlayerTexture.loadFromFile("player.png");
   PlayerSprite.setTexture(PlayerTexture);
   PlayerSprite.setPosition(sf::Vector2f(500, 275));
   PlayerSprite.setScale(sf::Vector2f(2, 2));


   //camera ?
   //sf::View Camera(sf::Vector2f(400.f, 300.f), sf::Vector2f(400.f, 300.f));
   //sf::Sprite* follow = &PlayerSprite;


   




   Tile001Texture.loadFromFile("tile001.png");
   //Tile001Sprite.setTextureRect(sf::IntRect(33, 30, 30, 30));
   Tile001Sprite.setTexture(Tile001Texture);
   
   //Tile001Rect.intersects
   Tile001Sprite.setPosition(sf::Vector2f(445,600));
   Tile001Sprite.setScale(sf::Vector2f(2,2));
   

   if (playpos == true) {
      PlayerSprite.setPosition(sf::Vector2f(33, 33));

   }
   
   
      
   
   


   
   
   

}



void GameScreen::UnloadContent() {

}

void GameScreen::Update() {
   if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
   {
      // left key is pressed: move our character
      //std::cout << "Player right" << std::endl;

      PlayerSprite.setTextureRect(sf::IntRect(52, 0, -53, 98));
      PlayerSprite.move(3.1, 0.0);
   }
   if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
   {
      // left key is pressed: move our character
      //std::cout << "Player  left" << std::endl;

      PlayerSprite.setTextureRect(sf::IntRect(0, 0, 53, 98));
      PlayerSprite.move(-3.1, 0.0);
   }

   

      if (sf::Keyboard::isKeyPressed(sf::Keyboard::LAlt))
      {
         //playpos = true;
         //PlayerSprite.setTextureRect(sf::IntRect(0, 0, 53, 98));
         //if (playpos == true)

            PlayerSprite.move(sf::Vector2f(0, -10));

         

         

         //comment teleport
         //if (PlayerSprite.getPosition().y) {
         //   PlayerSprite.setPosition(0, 0);
         //   PlayerSprite.move(sf::Vector2f(0,-1));
         //  }
         //comment no out fly y+
         //else PlayerSprite.move(sf::Vector2f(0, 1));
         //if (PlayerSprite.getPosition().y) {
            //PlayerSprite.setPosition(PlayerSprite);
               //}



      }
   
      // gravity
   for (int t = 0;t <= 5;t++) {

      PlayerSprite.move(sf::Vector2f(0,0.3));
      
      
   }

   xposplayer = PlayerSprite.getPosition().x;
   yposplayer = PlayerSprite.getPosition().y;
   xpostile001 = Tile001Sprite.getPosition().x;
   ypostile001 = Tile001Sprite.getPosition().y;
   while (xsetposplayer == true) {

      PlayerSprite.setPosition(PlayerSprite.getPosition());
      
   }

   if (PlayerSprite.getGlobalBounds().intersects(Tile001Sprite.getGlobalBounds())) {
      std::cout << "good job fool" << std::endl;
      
      
      


      if (xpostile001&&xposplayer) {
      //   PlayerSprite.move() = Tile001Sprite.move();
         std::cout << "1" << std::endl;
         xsetposplayer = true;
         if (sf::Keyboard::isKeyPressed(sf::Keyboard::End)) {
            //xposplayer = 66;

         }
      }
      else if (!xpostile001 && xposplayer) {
         xsetposplayer = false;
         std::cout << "2" << std::endl;
         
      }
   }
   else
   {
      std::cout << "no" << std::endl;
   }


   
   
   
   


}

void GameScreen::Draw(sf::RenderWindow& Window) {
   Window.draw(text);
   Window.draw(PlayerSprite);
   Window.draw(Tile001Sprite);
   Window.setFramerateLimit(60);

   
   
   
}

---------------------------------------------------------------------------------------------------------------------------


The point of this code is that im trying to get my playersprite to collide with the tilesprite
and move jump go to all following directions.
but i cant even continue because it crashes.


i know its a stupid way to make this happen but im trying hard to do it alone & my way u know what i mean.

im new to coding forgive me for the dumb coding mechanism.

10
Tnx bro im new to coding
im very stupid sorry
big tnx bro

11
i still get that pointer error :@ :(

12
this is the full code...........
----------------------------------


#include <SFML/Graphics.hpp>
#include <iostream>
int main()
{
   sf::RenderWindow Window(sf::VideoMode(800, 600), "My window" , sf::Style::Close);
   
   Window.setTitle("NULL Title");
   sf::Vector2u size = Window.getSize();
   unsigned int Width = size.x;
   unsigned int Height = size.y;
   Window.setSize(sf::Vector2u(999,777));
   Window.setPosition(sf::Vector2i(300,20));
   sf::WindowHandle handle = Window.getSystemHandle();
   Window.setVerticalSyncEnabled(true);
   //window.setFramerateLimit(60);
   sf::Event event;
   
   sf::Texture textureone;
   sf::Sprite spriteone;

   sf::Texture texturetwo;
   sf::Sprite spritetwo;

   
   while (Window.isOpen()) {
      sf::Event event;
      if (Window.pollEvent(event))
      {
         if (event.type == sf::Event::Closed || event.key.code == sf::Keyboard::Escape)
            Window.close();

      
      }

      Window.display();


      if (!textureone.loadFromFile("hs.png", sf::IntRect(111,111,111,111))) {
         std::cout << "nope" << std::endl;
      }
      //else
         //(std::cout << "yes" << std::endl);
      spriteone.setTexture(textureone);
      if (!texturetwo.loadFromFile("hs2.png", sf::IntRect(111, 111, 111, 111))) {
         std::cout << "nope2" << std::endl;
      }
      spritetwo.setTexture(texturetwo);

      //spritetwo.setPosition(sf::Vector2f(333,333));


      if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) {
         spritetwo.move(3,0);
      }
      if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) {
         spritetwo.move(-3, 0);
      }
      if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down)) {
         spritetwo.move(0, 3);
      }
      if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up)) {
         spritetwo.move(0, -3);
      }



      if (spriteone.getLocalBounds().intersects(spritetwo.getGlobalBounds)) {

      }


      Window.clear(sf::Color::White);

      Window.draw(spriteone);
      Window.draw(spritetwo);


      
   }
   
   

   return 0;
}

13
General / Pointer error [Fixed] by : Hapax
« on: June 26, 2019, 10:15:52 pm »
i need help, i've been stuggling since 1 day figure this out
◘◘◘◘Halp plox, i've been Stuggling for (3) {days} trying to figure this out◘◘◘◘

whenever i try to write 
for (int t = 0;t <= 5;t++) {
      PlayerSprite.move(sf::Vector2f(0,0.1));
      if (PlayerSprite.getGlobalBounds().intersects(Tile001Sprite.getGlobalBounds)) {
         std::cout << "tes" << std::endl;
      }

   }
the following error is : Severity   Code   Description   Project   File   Line   Suppression State
Error   C3867    'sf::Sprite::getGlobalBounds': non-standard syntax; use '&' to create a pointer to member   


ive been stuggling alot if someone can help me i will apriciate it alot  :-[


i cant write the PlayerSprite i dont understand what does this pointer & mean like where should i put it like i dont understand im mega confused im really confused.

Pages: [1]
anything