How can I rotate the player only to -40 or -45 degrees?

float c = 0.0f; private void FixedUpdate() {     if (startRotatingBack)     {         var p = transform.eulerAngles;          if (p.y != -40)         {             p.y -= 1;             transform.eulerAngles = p;         }          c = c + 0.1f;         playerAnimator.SetFloat("Forward", c);     } } 

The problem is that the transform keeps rotating nonstop.

Maybe the problem is with this chick?

if (p.y != -40) 

I want to make that the player will rotate backward. -40 or -45 is good enough but the player the transform is eep rotating nonstop so it’s making circles instead of rotating once to -40 or to -45.

Trying to get player movement from a class [closed]

I working on my game for the Ludum dare 48 game jam. I decided to learn raylib, the c++ version, to make a game. But my player code doesn’t even work. I have two files:
main.cpp:

#include "raylib.h"  int main() {     const int windowWidth = 1200;     const int windowHeight = 720;     InitWindow(windowWidth, windowHeight, "Ludum Dare 48");     /*Player*/     Player ply;     /*end of Player */     int rot = 0;     int increment = 1;     SetTargetFPS(60);     while (!WindowShouldClose()) {         BeginDrawing();         ClearBackground(RAYWHITE);                  ply.yes(windowWidth/2, windowHeight-50, 30,30);         EndDrawing();     } } 

and player.cpp

#include "raylib.h" class Player {     public:     int playerX;     int playerY;     void yes(int x, int y, int sizeX, int sizeY);     void input();              }; void Player::yes(int x, int y, int sizeX, int sizeY) {     DrawRectangle(x,y,sizeX,sizeY, RED);     if (IsKeyDown(KEY_RIGHT)) {             x++;         }         if (IsKeyDown(KEY_LEFT)) {             x--;         } } 

I get the error:
cc1plus.exe: warning: command line option '-std=c99' is valid for C/ObjC but not for C++

it looks like a compiler error, not an error in my code, but when the class is removed the code runs fine.

What are good ways to keep the player spending in a single-player RPG?

I’m designing a game where I want the player to take the in-game money into consideration as opposed to majority where they just get rich pretty much all the time with nothing meaningful to spend it on. What are some good ways to keep them spending their money without making it feel like a tedious chore?

I’m already planning to have monsters nor quests not give gold.

And if preventing them from becoming extremely rich eventually is not possible, at least mitigate "easy" ways of generating infinite income. I want them to struggle with their money.

If player is not holding the ladder then it should not jump twice

I am using Unity2d and I am stuck with a problem. In my game I gave the player a double jump ability. I want to the player to jump twice only if they hold the ladder.

The problem is that if the player jumps through the ladder without holding the ladder, it jumps twice (as if the user presses jump key twice) I want the player to only double if player holding the ladder and then presses jump. If the player just jumps through the ladder it should not jump twice.

Below is the player script:

[SerializeField]  [SerializeField] float _xSpeed = 1f; [SerializeField] float _ySpeed = 1f; [SerializeField] float _jumpForce = 1f; [SerializeField] float _distance; [SerializeField] LayerMask _ladderLayer; private float _horizontalMovement; private float _verticalMovement; private Rigidbody2D _rb; private bool _isClimbing; private bool _isMovingHorizontal = true;    [SerializeField] Transform _groundPos; [SerializeField] float _checkRadius; [SerializeField] LayerMask _groundLayer; private bool _isGrounded;    // ExtraJump private int _extraJumps; [SerializeField] int _extraJumpValue = 1;   void Start() {     _rb = GetComponent<Rigidbody2D>();     _extraJumps = _extraJumpValue;  }   void Update() {     _horizontalMovement = Input.GetAxis("Horizontal");     _verticalMovement = Input.GetAxis("Vertical");        }   void FixedUpdate() {     if(_isMovingHorizontal)     {         _rb.velocity = new Vector2( _horizontalMovement * _xSpeed,_rb.velocity.y);     }            _isGrounded = Physics2D.OverlapCircle(_groundPos.position,_checkRadius,_groundLayer);       if(_isGrounded == true)     {         _extraJumps = _extraJumpValue;              }     if(Input.GetKeyDown(KeyCode.Space) && _extraJumps > 0)     {         _rb.velocity = new Vector2(_rb.velocity.x,_jumpForce);         _extraJumps --;              }     else if(Input.GetKeyDown(KeyCode.Space) && _extraJumps == 0 && _isGrounded == true)     {                  _rb.velocity = new Vector2(_rb.velocity.x,_jumpForce);     }       RaycastHit2D hitLadder = Physics2D.Raycast(transform.position,Vector2.up,_distance,_ladderLayer);      if(hitLadder.collider == true)      {         if(Input.GetKey(KeyCode.W))         {             _isClimbing = true;             _rb.gravityScale = 0;         }         else         if(Input.GetKey(KeyCode.Space))          {             _isClimbing = false;                              }            }                     if(_isClimbing == true && hitLadder.collider == true)     {                     _rb.velocity = new Vector2(_rb.velocity.x,_verticalMovement *          _ySpeed);              }     else     {         _rb.gravityScale = 1;     }       } 

How should I as a GM handle a player *character* who has a bad memory?

There is a player in my campaign who’s characters defining trait is that they have a bad memory.

I like creating mechanical representations of character traits if it makes sense to do so.

I’ve given the player a Homebrew feat called "bad memory" that basically says "roll disadvantage on any memory based intelligence checks".

My reasoning being that a character with bad memory should not have the same statistical probability of rolling well on a memory based check as a character with a good memory.

This player is adamantly fighting me on this though.

This is his reasoning:

The game already has the scaffolding and complexity in the locations where it is required. There are reasons why things like forgetfulness are included in the traits and features yet don’t have mechanics attached to them. If it was appropriate they would have been added by the devs. Mechanics which make it harder to use a character, and especially mechanics which remove abilities from players, are things which are only used in very rare cases and only ever for very short periods.

Note: This player is a very good role-player. It feels wrong to me to not represent the bad memory mechanically though.

How should I as a GM handle this situation?

How do I accommodate a blind player at my remote table?

For remote play at our table, we use a camera stuck on a microphone-boom-arm that we can rotate by 360°. We found out that we prefer it to have our rest position at about 45°, instead of top-down because the top-down angle creates nausea for some of our players, and it simulates sitting at a table. We use a 19 by 19 go-board with numbered and lettered tiles to make calls based on a grid for combat encounters and other visualisation when appropriate. For indicating features, we use a mix of miniatures that were part of the 2002 D&D boardgame by Hasbro and cardboard printouts that create terrain objects by sliding them together at a 90° angle with little plastic sockets, so they don’t topple over.

I designed our base set-up for remote play to feign an in-person feeling by visualisation.

I will have a remote guest player for three sessions who is blind, and I’m looking for preparations and ways to accommodate them and make our set-up as accessible as reasonable. What can I do to optimise the experience for them in particular, and so in turn for all of us?

How can I keep a player from “shutting down” after a streak of bad rolls?

In my sessions I’ve repeatedly noted that after a few bad rolls, one of my players (age 20) seems to become reclusive and stop paying attention.

Now I’ve tried various methods to get the player to pay attention again, but it seems that no matter how much his PC is punished or rewarded in game, even to the point of almost dieing to a hefty bag of gold, that this player did not care. I’ve even tried abstract methods, and given him a verbal slap, getting the other players to laugh at his PCs expense just to see if he’d dignify his character. Complete disconnect. The Player didn’t even care.

A Few rounds later, the dice rolls are in his favor, and suddenly, he cares about the story again! Participation happens, and the players are moving nicely.

This is bad for both of us. For me because suddenly I’ve got a brain dead PC that is being lugged around, slowing the game. For him, because he isn’t enjoying the game.

How do I as a DM prevent the disconnect that happens when players are on a bad luck streak?

How should my Warlock player use their familiar during battles?

One of my players has a Warlock character and is using Pact of the Chain for their Pact Boon. They most often cast a pseudodragon as their familiar, but neither of us are sure about how they should be using the pseudodragon during fights. Does the familiar get its own turn in the turn order? Or can the familiar only act when the Warlock gives up their action slot? I read the PHB content, but I’m still unclear how/if the pseudodragon should be used in fights.

How do I deal with a fellow player who cheats, if the GM won’t do anything about it?

I have played with this same group of friends for over 20 years. However due to covid we have had to play virtually using roll 20.
This has had the surprising and revealing effect of letting us see that one of the player cheats a lot. The other players, and the GM don’t seem to care, and if I publicly call him out on his shenanigan’s (in a very polite and non-accusing way), he just does it anyway and no one seems to care.

I have tried to roll with it and just ignore it, but it just feels so disrespectful to me, I think I may have to quit the group.

Does anyone have any suggestions?

How can I create a walking zone logic for my player?

First I will show a screenshot and explain the logic I think of and what I’m trying to do :

Diagram

The small circle is the Player.

The black rectangle is the target the player is walking towards.

The green zone is where the player slow down. Once entering the green zone and facing the target by calculating the distance from the target the player start slowing down until stop.

When the player just rotating facing the opposite direction away from the target in this point something show switch the speed logic if the player was slow down to stop if the player is facing the opposite direction he can start walking again and the speed should be increasing slowly to the normal speed the same idea when slowing down to stop so speed up to normal.

Now if the player is leaving the green zone once left the green zone using a flag or some helper and reset everything so if the player will enter the green zone again facing the target he will slow down to stop again.

  • When the player is getting some distance from the target and facing the target slow down to stop.

  • When the player stopped and then if the player rotating facing the opposite direction let the player the option to move again with increasing the speed back to normal.

  • When the player is moving away from the target some distance for example out the green zone reset everything and if the player will face the target again and enter the green zone as distance from target slow down to stop again.

This script is attached to some object and make the logic I wanted :

using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine;  public class FireEffect : MonoBehaviour {     public GameObject player;     public GameObject longDistanceDescriptionTextImage;     public TextMeshProUGUI text;      private Animator playerAnimator;     private float timeElapsed = 0;     private float lerpDuration = 3;     private float startValue = 1;     private float endValue = 0;     private float valueToLerp = 0;     private float angle;      // Start is called before the first frame update     void Start()     {         angle = transform.eulerAngles.y;         playerAnimator = player.GetComponent<Animator>();     }      // Update is called once per frame     void Update()     {         var distance = Vector3.Distance(player.transform.position, transform.position);          Vector3 dir = (transform.position - player.transform.position).normalized;         float dot = Vector3.Dot(dir, player.transform.forward);          angle = transform.eulerAngles.y;         if (distance < 10 && dot > 0.9f)         {             if (timeElapsed < lerpDuration)             {                 valueToLerp = Mathf.Lerp(startValue, endValue, timeElapsed / lerpDuration);                 playerAnimator.SetFloat("Forward", valueToLerp);                 timeElapsed += Time.deltaTime;             }             playerAnimator.SetFloat("Forward", valueToLerp);             longDistanceDescriptionTextImage.SetActive(true);             text.text = "It's too hot , I can't continue.";         }         else         {             if (dot < -0.9f)             {                 if (timeElapsed > lerpDuration)                 {                     valueToLerp = Mathf.Lerp(endValue, startValue, timeElapsed / lerpDuration);                     playerAnimator.SetFloat("Forward", valueToLerp);                     timeElapsed += Time.deltaTime;                 }                 playerAnimator.SetFloat("Forward", valueToLerp);             }         }     } } 

I’m not sure if this is the right way to make the script but it does working for the slow down to stop part :

if (distance < 10 && dot > 0.9f)         {             if (timeElapsed < lerpDuration)             {                 valueToLerp = Mathf.Lerp(startValue, endValue, timeElapsed / lerpDuration);                 playerAnimator.SetFloat("Forward", valueToLerp);                 timeElapsed += Time.deltaTime;             }             playerAnimator.SetFloat("Forward", valueToLerp);             longDistanceDescriptionTextImage.SetActive(true);             text.text = "It's too hot , I can't continue.";         } 

but it’s not working in the else part the speed is not increasing slowly back to normal but increasing at once to normal. The lerp is not working for the increasing back.

another problem is when the player in the else part facing away from the target if I will rotate the player with the keys and move him again to the target he will walk regular nonstop to the target without slow down again.

I’m not sure what logic should be here for 100% but I think if the player is facing away from the target start increasing to normal speed and if in the middle I rotate the player facing the target again because I’m inside the green zone then slow down to stop the player maybe a bit faster to keep the same 10 distance like in the script from the target. Don’t let the player to pass over the 10 distance from the target when facing the target.