- Add background which scrolls with viewport - Remove box made of blocks, use simple platform - Players below y > 9000 are teleported back - Add a couple of Network shorthand properties: - IsMultiplayerReady - Is multiplayer fully ready? - IsAuthoratative - Is singleplayer or server? - Players - Enumerable of all current players - Make LocalPlayer.Velocity public - Add LocalPlayer.ResetPosition call - Rpc and Rset extension methods now use Network shorthands and Player instancesmain
parent
e1d83a4af1
commit
7a5d8ac29e
11 changed files with 121 additions and 53 deletions
After Width: | Height: | Size: 4.8 KiB |
@ -0,0 +1,34 @@ |
||||
[remap] |
||||
|
||||
importer="texture" |
||||
type="StreamTexture" |
||||
path="res://.import/background.png-34463f2717b0502091d019b33ae7e4f3.stex" |
||||
metadata={ |
||||
"vram_texture": false |
||||
} |
||||
|
||||
[deps] |
||||
|
||||
source_file="res://gfx/background.png" |
||||
dest_files=[ "res://.import/background.png-34463f2717b0502091d019b33ae7e4f3.stex" ] |
||||
|
||||
[params] |
||||
|
||||
compress/mode=0 |
||||
compress/lossy_quality=0.7 |
||||
compress/hdr_mode=0 |
||||
compress/bptc_ldr=0 |
||||
compress/normal_map=0 |
||||
flags/repeat=1 |
||||
flags/filter=false |
||||
flags/mipmaps=false |
||||
flags/anisotropic=false |
||||
flags/srgb=2 |
||||
process/fix_alpha_border=true |
||||
process/premult_alpha=false |
||||
process/HDR_as_SRGB=false |
||||
process/invert_color=false |
||||
stream=false |
||||
size_limit=0 |
||||
detect_3d=false |
||||
svg/scale=1.0 |
@ -0,0 +1,14 @@ |
||||
using Godot; |
||||
|
||||
public class Background : TextureRect |
||||
{ |
||||
public override void _Process(float delta) |
||||
{ |
||||
var offset = new Vector2(8, 8); |
||||
var tileSize = Texture.GetSize(); |
||||
var viewportSize = GetViewport().Size; |
||||
var camera = LocalPlayer.Instance.GetNode<Camera2D>("Camera"); |
||||
RectPosition = ((camera.GlobalPosition - viewportSize / 2) / tileSize).Floor() * tileSize - offset; |
||||
RectSize = ((viewportSize + offset) / tileSize + Vector2.One).Ceil() * tileSize; |
||||
} |
||||
} |
Loading…
Reference in new issue