How to implement barriers to stop the player moving through walls

Compute the bounding rectangle of the player and compute the grid indices of the corner points and and center point: player_rect = pygame.Rect(player.x, player.y, wr-3, hr-3) xC, yC = int(player_rect.centerx / wr), int(player_rect.centery / hr) x0, y0 = int(player_rect.left / wr), int(player_rect.top / hr) x1, y1 = int(player_rect.right / wr), int(player_rect.bottom / hr) Restrict the … Read more

JSF 2 Global exception handling, navigation to error page not happening

It’s most likely because the current request is an ajax (asynchronous) request. The exception handler which you’ve there is designed for regular (synchronous) requests. The proper way to change the view in case of an ajax exception is as follows: String viewId = “/error.xhtml”; ViewHandler viewHandler = context.getApplication().getViewHandler(); context.setViewRoot(viewHandler.createView(context, viewId)); context.getPartialViewContext().setRenderAll(true); context.renderResponse(); This is however … Read more