python – Player not moving camera to the other side of the screen when hitting the screen edge

I’m working on a game where I want the player to appear on the other side of the screen when they get to the edge of the screen, essentially mimicking the background moving. When the player gets to the edge of the map, they shouldn’t be able to move anymore. I’m just trying to get the first part to work where the player appears on the other side of the screen after hitting the edge. My full code is below.

#Import the pygame module
import pygame
from pygame.locals import (


BLUE = (0,0,255)
PURPLE = (153,50,204)
GREEN = (0,128,0)


class Map():
    def __init__(self,map): = map
    def update_map(self):

# Define constants for the screen width and height
# Setup the clock for a decent framerate
clock = pygame.time.Clock()

# Define a player object by extending pygame.sprite.Sprite

# The surface drawn on the screen is now an attribute of 'player'
worldMaxX = SCREEN_WIDTH*3


class Camera():
    def __init__(self):
        self.worldX = 0
        self.worldY = 0
        self.cameraX = SCREEN_WIDTH
        self.cameraY = SCREEN_HEIGHT
    def worldCoordinates(self,screenX, screenY):
        worldX = self.cameraX + screenX
        worldY = self.cameraY + screenY
        return (worldX, worldY)

    def screenCoordinates(self,worldX, worldY):
        screenX = worldX - cameraX
        screenY = worldY - cameraY
        return (screenX,screenY)

class Player(Camera):
    def __init__(self):
        self.player_surface = pygame.Surface((25, 25))
        self.player_surface.fill((255, 0, 255))
        self.rect = self.player_surface.get_rect(center = (25,25))

    def update(self, pressed_keys):
        # Move the sprite based on user keypresses
        if pressed_keys(K_w):
            self.worldX,self.worldY = self.worldCoordinates(self.rect.x,self.rect.y)
            self.worldY -= SPEED
            self.rect.x,self.rect.y =  self.screenCoordinates(self.worldX,self.worldY)

        if pressed_keys(K_s):
            self.worldX,self.worldY = self.worldCoordinates(self.rect.x,self.rect.y)
            self.worldY += SPEED

            self.rect.x,self.rect.y =  self.screenCoordinates(self.worldX,self.worldY)

        if pressed_keys(K_a):
            self.worldX,self.worldY = self.worldCoordinates(self.rect.x,self.rect.y)
            self.worldX -= SPEED

            self.rect.x,self.rect.y =  self.screenCoordinates(self.worldX,self.worldY)

        if pressed_keys(K_d):
            self.worldX,self.worldY = self.worldCoordinates(self.rect.x,self.rect.y)
            self.worldX += SPEED
            self.rect.x,self.rect.y =  self.screenCoordinates(self.worldX,self.worldY)

    def updateCamera(self):
    #Move camera
        if (self.rect.x < 0):
            self.rect.x = SCREEN_WIDTH
        if (self.rect.x >= SCREEN_WIDTH):
            self.rect.x = 0
        if (self.rect.y <= 0):
            self.rect.y = SCREEN_HEIGHT
        if (self.rect.y >= SCREEN_HEIGHT):
            self.rect.y = 0

    def render(self,position):
        screen.blit(self.player_surface, position)

# Initialize pygame

# Create the screen object
# The size is determined by the constant SCREEN_WIDTH and SCREEN_HEIGHT
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))

# Instantiate player. Right now, this is just a rectangle.
player = Player()

# Variable to keep the main loop running
running = True

# Main loop
while running:

    # for loop through the event queue

    for event in pygame.event.get():
        # Check for KEYDOWN event

        if event.type == KEYDOWN:
            # If the Esc key is pressed, then exit the main loop
            if event.key == K_ESCAPE:
                running = False
        # Check for QUIT event. If QUIT, then set running to false.
        elif event.type == QUIT:
            running = False

    # Get all the keys currently pressed
    pressed_keys = pygame.key.get_pressed()

    # Fill the screen with black
    screen.fill((0, 0, 0))

    # Draw the player on the screen

    # Update the display


What happens though is that my player square doesn’t appear on the other side of the screen when going left or up. But, I don’t understand why. I thought the code below would work, which it does when moving right, and down, but not up or left. What am I doing wrong with the camera method updateCamera that this isn’t happening the way I expect it too?

    def updateCamera(self):
    #Move camera
        if (self.rect.x < 0):
            self.rect.x = SCREEN_WIDTH
        if (self.rect.x >= SCREEN_WIDTH):
            self.rect.x = 0
        if (self.rect.y <= 0):
            self.rect.y = SCREEN_HEIGHT
        if (self.rect.y >= SCREEN_HEIGHT):
            self.rect.y = 0

Faceted filtering vs side wide search

It really depends on the context of your case:

  • Is it for a “power user” tool?
  • Is it for single-visit context?
  • Is it a technical website/store (like industry-specific store or something)?

Depending on the answers, you might want to keep your global search as-is, or adjust its behavior.

Narrowing down is normal

When you are looking for something on a website, you often start by visiting around to better understand what the website proposes.
It’s part of the human brain to see global before narrowing down information to reach a more precise goal.

Searching is not different: you search global with some keywords, then you want to adjust regarding the categories and filters the interface/store proposes.

That is for the usual behavior, it might not be the right solution for power-users or really technical domain related website/store.

Advanced filters for power-users

You global search might propose advanced keyword or syntax like Google does.
For instance, when you want result for a specific website, Google allows you to limit your search to a specific domain with this syntax: faceted filter site wide

You can also use modifier to change the meaning of your research, like: "faceted filter" site wide

This one means “not in this site”, and I look for the exact term “faceted filter” into the results.

You could totally imagine keywords for your categories. Let’s take a shoes store example:

brand:martens size:44 color:black winter shoes

Could lead me to pre-filtered search for “winter shoes” of a brand containing “Martens” with a 44 size and black color. Your choice then to allow a bit of fuzziness around the results by providing with 44.5 and 43.5, black and dark blue shoes, for instance.

It doesn’t mean that the global research must only be the only way you can filter things, but it could be a good start to bring a powerful tool for your power-users, and keep the sidebar with filters for beginners, after a first more global search.

Of course, that’s only my opinion and point of view. Best is to analyse your context and ask to users 😊

orders – Magento 2: Which event fires when I reorder from admin side?

I have activated reorder on my magento 2 site. Now I want a event which can catch reorder both in frontend and backend (admin). I am using “controller_action_predispatch_sales_order_reorder” for my front end which is working perfectly fine but I want to catch reorder on the backend as well. Can anyone tell me which event to use for backend as “controller_action_predispatch_adminhtml_sales_order_create_reorder” is not working for backend?

Here is my code:


<?xml version="1.0"?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="controller_action_predispatch_adminhtml_sales_order_create_reorder">
    <observer name="admin_reorder_observer" instance="VoltLightingOrderInfoObserverAdminReorder" />

<event name="checkout_submit_all_after">
    <observer name="admin_order_observer" instance="VoltLightingOrderInfoObserverAdminOrder" />

Observer file


namespace VoltLightingOrderInfoObserver;

use MagentoFrameworkEventObserver;

use MagentoFrameworkEventObserverInterface;

class AdminReorder implements ObserverInterface

public function execute(Observer $observer)
    $order= $observer->getEvent();

    echo "hello world";


enter image description here

javascript – jQuery (server side) search and sort using Ajax

I tried to create an search and sort from live URL using ajax

I tried to create an search live using Ajax

I am showing Ajax response in select options as below code. I want to sort the select options in alphabetical order of values.
But now i want to add pagination search and sort for that.I used lots of tutorials to do that. But i can’t understand. To anyone who knows please help me to do that. Thank you.

Please provide a solution to sort below data on values basis (by level). My data is like :
Level: 99 👑ℂᎩℕU$⭐️id:16110891847172013476
Level: 39 👌HanSoloD㊂lo🎶id:16110914410897703121
Level: 84 SKULL⚓⛵🏴‍☠️id:16110908459448803417
Level: 39 🏁Brutha3rd𓂀id:16110911398345043830
Level: 49 RF George 🦅🔥id:16110770935818465206
Level: 90 Auggie98🌺🍾id:16110907549357360528

So far I have this code:
function do Search(){
$. Ajax({
URL: ‘’,

    data: {
        page_size: 10,
        page_index: current_page
    cache: false,
    type: 'GET',
    datatype: 'JSON',
    success: function(r){

        var max = $('#limit'). VAL();
        if ( < max) max =;

        for (index = 0; index < max; index++) {
            var entry =;
            var level = parse Int(entry.level);
                            if ((level > $('#min'). val()) && (level < $('#max'). val())) {
                var h = '<div class="entry '+'"><h="'+entry+'">';
                h += '<h3>Level: <span>'+entry.level+'</span> <span>'+entry.uname+''+'</span>id:<span>'+entry.Vid;
                h += '</div>';
                $('#main'). append(h);



spfx – Server side validation in SharePoint Framework (SharePoint Online)

I am working on a SharePoint Framework based project in SharePoint Online and using React JS as front-end library. I am also using Redux for state management and React Hooks. I want to know how can I implement server-side validation in SharePoint Framework (with react JS), although I have already implemented client-side validations on the forms/components and on all the mandatory fields.

However, in the security testing of the application, it has been reported as an issue that there should be strict server-side validation in the fields – For Eg. – file types validation, file extension. Additionally, the application should implement strict server-side validation against all the mandatory fields in all the application forms / registration pages of the application.

Please suggest how can I achieve this.

Your early response would be highly appreciable, thanks in advance.

How do I fix this? Sort by rearranges the order of my Product Categories in the left side widget

I used a plugin called Custom Taxonomy Order NE to rearrange the order of my Product Categories (commonly seen on e-commerce websites on the left sidebar). I used a widget for the Product Categories "menu". When I use the sort by price etc. the Product Categories order rearranges. How can I fix this? Somehow the drop down – sort by price isn’t seeing the plugin.

dnd 5e – Should a Bugbear PC take damage when holding an enemy on the other side of a Wall of Fire with Grapple?

Bugbears have long arms, allowing them to grapple enemies 10 ft. away.

The Bugbear’s square is not in the effect range of the Wall of Fire.
However, one of the Bugbear’s hands is supposedly in a square that is.

Mechanically, should the Bugbear take damage? If so, simulationally, how do we reconcile that such a small fraction of the player being in the square and taking just as much damage as a character residing fully in the area of effect?

real analysis – Side limits of ${displaystyle lim_{xto0}frac{|sinleft(frac{1}{x}right)|}{1 + 2^{1/x}}}$

I need to find the side limits of this function, if they exist. I’ve tried dividing both D and N with 1/x, but that didn’t help either. According to the book the left-side limit doesn’t exist, and right-side limit is 1. How could I solve this problem?

${displaystyle lim_{xto0}frac{|sinleft(frac{1}{x}right)|}{1 + 2^{1/x}}}$