origin_y=.5, scale=(1000, 100, 10), collider='box', ignore=True, ) random.seed(4) for i in range(10): Entity(model='cube', color=color.dark_gray, collider='box', ignore=True, position=(random.randint(-20, 20), random.randint(0, 10)), scale=(random.randint(1, 20), random.randint(1, 5), 10)) player = PlatformerController2d(color=color.green.tint(-.3)) player.x = 1 player.y = raycast(player.world_position, player.down).world_point[1] camera.smooth_follow.offset[1] = 5 window.size = (window.fullscreen_size[0] // 2, window.fullscreen_size[1] // 2) window.position = (int(window.size[0]), int(window.size[1] - (window.size[1] / 2))) window.borderless = False window.fullscreen = False input_handler.bind('right arrow', 'd') input_handler.bind('left arrow', 'a') input_handler.bind('up arrow', 'space') app.run()
self.y = y app = Ursina() speed = 1 switch = 1 dx = 0 shrink = 2 size = 13 bg = Entity(model='quad', scale=(size, 6), texture='assets/sky_cloud', z=0.5) player = PlatformerController2d(y=1, z=-0.01, scale=(1, 1), color=color.white, texture='assets/guy.png') ground = Entity(model='quad', y=-2, scale_x=10, collider='box', color=color.yellow) wall = Entity(model='cube', color=color.azure, scale=(1, 3), x=5.5, collider='box') level = Entity(model='quad', color=color.violet, scale=(3, 1),
import objects from ursina import * from ursina.prefabs.platformer_controller_2d import PlatformerController2d app = Ursina() player = PlatformerController2d(position=(0, 0), collision=True, color=color.red) camera.add_script(SmoothFollow(target=player, offset=[0.5, -30], speed=40)) def update(): player.x += held_keys['d'] * time.dt * 2 player.x -= held_keys['a'] * time.dt * 2 app.run()
collider='box', ignore=True) random.seed(4) for i in range(10): Entity(model='cube', color=color.dark_gray, collider='box', ignore=True, position=(random.randint(-20, 20), random.randint(0, 10)), scale=(random.randint(1, 20), random.randint(2, 5), 10)) # ground = Entity(model='cube', color=color.white33, origin_y=.5, scale=(20, 10, 1), collider='box') # wall = Entity(model='cube', color=color.azure, origin=(-.5,.5), scale=(5,10), x=10, y=.5, collider='box') # ceiling = Entity(model='cube', color=color.white33, origin_y=.5, scale=(10, 1, 1), y=4, collider='box') player = PlatformerController2d() player.x = 1 player.y = raycast(player.world_position, player.down).world_point[1] + .01 camera.add_script(SmoothFollow(target=player, offset=[0, 5, -30], speed=4)) input_handler.bind('right arrow', 'd') input_handler.bind('left arrow', 'a') input_handler.bind('up arrow', 'space') input_handler.bind('gamepad dpad right', 'd') input_handler.bind('gamepad dpad left', 'a') input_handler.bind('gamepad a', 'space') # test from ursina.scripts.noclip_mode import NoclipMode2d player.add_script(NoclipMode2d())
window.title = "Platformer" window.color = rgb(100, 170, 208) window.fullscreen = True color_grass = rgb(43, 130, 0) color_finish_1 = color.black color_finish_2 = color.white last_x = 0 pre_finish = 7 amount_deaths = 0 print_deaths = "Deatsh", amount_deaths player = PlatformerController2d( scale=(1, 1), position=(0, 4), collision=True, color=rgb(255, 139, 0), ) control_help = Entity(position=(-8, 3), model="quad", scale=(8, 6), texture="images/control") control_help = Entity(position=(-7.3, 0), model="quad", scale=(6, 2), texture="images/control2") gimp_easter_egg = Entity(position=(-10.5, -4.5), model="quad",
from ursina import * from ursina.prefabs.platformer_controller_2d import PlatformerController2d app = Ursina() player = PlatformerController2d(y=1, z=.01, scale_y=1, color=color.green) ground = Entity(model='quad', y=-2, scale_x=10, collider="box", color=color.yellow) wall = Entity(model='quad', color=color.azure, scale=(1, 5), x=5.5, collider="box") level = Entity(model='quad', color=color.red, scale=(3, 1), x=2, collider='box') ceiling = Entity(model='quad', color=color.blue, scale=(3, 1), x=3, collider='box') app.run()
# Start by importing ursina and creating a window. from ursina import * app = Ursina() # ## Using the built in platformer controller # # A simple way to get stared is to use the built in platformer controller. # It's pretty basic, so you might want to write your own at a later point. # It is however a good starting point, so let's import it like this: from ursina.prefabs.platformer_controller_2d import PlatformerController2d player = PlatformerController2d(y=1, z=.01, scale_y=1, max_jumps=2) # You can change settings like jump_height, walk_speed, and gravity. # If you want to larn more about how it works you can read its code here: # https://github.com/pokepetter/ursina/blob/master/ursina/prefabs/platformer_controller_2d.py # # If we try to play the game right now, you'll fall for all infinity, so let's add a ground: ground = Entity(model='quad', scale_x=10, collider='box', color=color.black) # ## Making a "level editor" # # Now, it works, but it's a pretty boring game, so let's make a more interesting level. # There are many ways to go about making a level, but for this we'll make an image # where we can simply draw the level and then generate a level based on that. # # # image platformer_tutorial_level.png # # # # To generate the level we'll loop through all the pixels in the image above and do # something based on the color of the pixel. Make sure to save this image to same
Audio('assets/coin_sound.wav') num += 100 text.y = 1 text=Text(text=f"{num} Subscribers",position=(0,0.4),origin=(0,0),scale=2,color=color.yellow,background=True) bonuses.remove(bonus) destroy(bonus) if num >=1000: Text(text="Thank You for Your Support!",origin=(0,0),scale=3,color=color.yellow,background=True) ## app = Ursina() m = 0 n_frame = 400 # Entities bg = Entity(model='quad', scale=(20,10), texture='assets/bg',z=0.5) player = PlatformerController2d(y=-3, scale=(.4,.8,.01/2),color=color.white, texture='assets/guy.png') ground = Entity(model='quad', y=-4, scale_x=15, collider='box', color=color.orange) wall = Entity(model='quad', color=color.azure, scale=(1,9), x=7.5, collider='box') duplicate(wall,x=-7.5) # Levels xy = [[-1,0],[-5,-1.5],[5,-0.5],[-7,1.3],[3,2]] levels = [] level = Entity(model='quad', texture='assets/pad_01.png',scale=(2,0.7),position=xy[0], collider = 'box') levels.append(level) levels.append(duplicate(level, texture='assets/pad_02.png',position=xy[1])) levels.append(duplicate(level, texture='assets/pad_03.png',position=xy[2])) levels.append(duplicate(level, texture='assets/pad_04.png',position=xy[3]))
from ursina import * from ursina.prefabs.platformer_controller_2d import PlatformerController2d window.fullscreen = True # create a window app = Ursina() player = PlatformerController2d(position = (0, -2), collision = True, ) for i in range(11): counter for j in range(6): tile = Entity(model = "quad", x = counter, y = ) counter += 1 app.run()
ground = Entity(model='cube', color=color.rgb(50, 180, 50), z=0.1, y=-8, scale=(100, 5, 10), collider='box') wall = Entity(model='cube', color=color.rgb(50, 180, 50), collider='box', position=(-3, 0), scale=(5, 1)) player = PlatformerController2d(position=(-15, -5), texture='boshy.png', color=color.white, scale=1, max_jumps=2) spikes = [] for i in range(10): spike = Entity(model='cube', texture='spike.png', color=color.white, collider='box', position=(random.randint(-10, 10), -5), scale=1) spikes.append(spike)
from ursina import * from ursina.prefabs.platformer_controller_2d import PlatformerController2d app = Ursina() window.title = 'Platformer' window.color = color.gold window.fullscreen = True player = PlatformerController2d(position=(-8, 0), collider='box', collision=True, color=color.white, texture='brick') camera.add_script(SmoothFollow(target=player, offset=[0.5, -30], speed=40)) def update(): player.x += held_keys['d'] * time.dt * 2 player.x -= held_keys['a'] * time.dt * 2 def input(key): if key == 'enter': player.position = (0, -1) """ def draw_world(x = 0, y = 0, columns = 0): def draw_column(height = 5):