Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Vardas pavarde
- import ptmx.*;
- Ptmx map;
- int x, y;
- PImage marioImg;
- PImage[] marioImgArray;
- void setup() {
- size(1000, 480);
- map = new Ptmx(this, "level3.tmx");
- marioImg = loadImage("Mario_and_Enemies.png");
- marioImgArray = new PImage[6];
- }
- void draw()
- {
- map.draw(x, y);
- moveWorld();
- drawMario();
- }
- void drawMario()
- {
- PImage mariosmall;
- for(int i= 0 ;i<6;i++)
- {
- mariosmall = marioImg.get(1+i*16, 30, 16, 30);
- image(mariosmall, 30+i*100, 300, 50, 80);
- }
- }
- void moveWorld()
- {
- if(keyPressed)
- {
- if(key=='a' || key=='A')
- {
- x = x - 16;
- }
- if(key=='d' || key=='D')
- {
- x = x+ 16;
- }
- if(key=='w' || key=='W')
- {
- y = y-16;
- }
- if(key=='s' || key=='S')
- {
- y = y+16;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement