Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage example for draw_sprite #233

Open
wants to merge 1 commit into
base: usage-examples
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

using SplashKitSDK;

namespace draw_sprite
{
public class Program
{
public static void Main()
{
SplashKit.OpenWindow("draw_sprite", 600, 600);

SplashKit.LoadBitmap("player", "player.png");
Sprite playerSprite = SplashKit.CreateSprite(SplashKit.BitmapNamed("player"));
SplashKit.SpriteSetX(playerSprite, 300);
SplashKit.SpriteSetY(playerSprite, 300);
SplashKit.ClearScreen(SplashKit.ColorBlack());

// Draw the sprite
SplashKit.DrawSprite(playerSprite);

SplashKit.RefreshScreen();
SplashKit.Delay(5000);
SplashKit.CloseAllWindows();
}
}
}
17 changes: 17 additions & 0 deletions public/usage-examples/sprites/draw_sprite/draw_sprite-1-simple.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from splashkit import *

start = open_window("draw_sprite", 600, 600)

load_bitmap("player", "player.png")
player_sprite = create_sprite(bitmap_named("player"))
sprite_set_x(player_sprite, 300)
sprite_set_y(player_sprite, 300)

clear_screen(color_black())

#Draw the sprite
draw_sprite(player_sprite)

refresh_screen()
delay(5000)
close_all_windows()