Skip to content

Commit 4d72209

Browse files
committed
wizard 2d platformer roguelike based on spelunky
0 parents  commit 4d72209

File tree

289 files changed

+11246
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

289 files changed

+11246
-0
lines changed

.config/dotnet-tools.json

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"dotnet-mgcb": {
6+
"version": "3.8.1.303",
7+
"commands": [
8+
"mgcb"
9+
]
10+
},
11+
"dotnet-mgcb-editor": {
12+
"version": "3.8.1.303",
13+
"commands": [
14+
"mgcb-editor"
15+
]
16+
},
17+
"dotnet-mgcb-editor-linux": {
18+
"version": "3.8.1.303",
19+
"commands": [
20+
"mgcb-editor-linux"
21+
]
22+
},
23+
"dotnet-mgcb-editor-windows": {
24+
"version": "3.8.1.303",
25+
"commands": [
26+
"mgcb-editor-windows"
27+
]
28+
},
29+
"dotnet-mgcb-editor-mac": {
30+
"version": "3.8.1.303",
31+
"commands": [
32+
"mgcb-editor-mac"
33+
]
34+
}
35+
}
36+
}

BasicTile.cs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace monowizard
8+
{
9+
internal class BasicTile : Tile
10+
{
11+
12+
public override void tileEffect(int side, int ind,Entity e)
13+
{
14+
15+
}
16+
}
17+
}

Batdemon.cs

+159
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
using Microsoft.Xna.Framework;
2+
using Microsoft.Xna.Framework.Graphics;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using System.Numerics;
7+
using System.Text;
8+
using System.Threading.Tasks;
9+
using Vector2 = Microsoft.Xna.Framework.Vector2;
10+
11+
namespace monowizard
12+
{
13+
internal class Batdemon : Entity
14+
{
15+
//public Texture2D battexture;
16+
public Player player;
17+
//Rectangle hitbox = new Rectangle(1200, 500, 80, 80);
18+
Rectangle drawbox = new Rectangle(0, 0, 128, 128);
19+
Rectangle cropbox = new Rectangle(0, 0, 128, 128);
20+
Rectangle tophitbox = new Rectangle(0, 0, 90, 5);
21+
int aniframe = 0;
22+
public bool flapdown;
23+
public bool leftward = false;
24+
public SpriteEffects facingeffect = SpriteEffects.None;
25+
CollisionCheck check;
26+
int playerdirx;
27+
int playerdiry;
28+
Rectangle playerfeet;
29+
MonsterManager mm;
30+
31+
32+
33+
34+
public Batdemon(Player player,MonsterManager mm)
35+
{
36+
this.player = player;
37+
id = 33;
38+
hitbox = new Rectangle(1200, 500, 100, 80);
39+
check = player.colcheck;
40+
bounce = 100;
41+
this.mm = mm;
42+
43+
44+
45+
}
46+
47+
public override void update()
48+
{
49+
yvel = 0;
50+
xvel = 0;
51+
52+
playerdirx = hitbox.X - player.hitbox.X;
53+
playerdiry = hitbox.Y - player.hitbox.Y;
54+
if (playerdirx < -5)
55+
{
56+
xvel++;
57+
if(facingeffect == SpriteEffects.FlipHorizontally)
58+
{
59+
facingeffect = SpriteEffects.None;
60+
}
61+
}
62+
else if (playerdirx > 5)
63+
{
64+
xvel--;
65+
if (facingeffect == SpriteEffects.None)
66+
{
67+
facingeffect = SpriteEffects.FlipHorizontally;
68+
}
69+
}
70+
71+
if (playerdiry < -20)
72+
{
73+
yvel++;
74+
}
75+
else
76+
{
77+
yvel--;
78+
}
79+
80+
81+
colliding = false;
82+
grounded = false;
83+
check.checkTile(this);
84+
85+
86+
hitbox.X += xvel;
87+
hitbox.Y += yvel;
88+
89+
hitCheck();
90+
91+
92+
93+
94+
95+
96+
aniframe++;
97+
if (aniframe % 5 == 1)
98+
{
99+
if (flapdown)
100+
{
101+
cropbox.X += 128;
102+
if(cropbox.X > 700)
103+
{
104+
cropbox.X -= 128;
105+
flapdown = false;
106+
107+
}
108+
}
109+
else
110+
{
111+
cropbox.X -= 128;
112+
if (cropbox.X < 0)
113+
{
114+
cropbox.X += 128;
115+
flapdown = true;
116+
117+
}
118+
119+
}
120+
121+
}
122+
123+
if(aniframe == 60)
124+
{
125+
aniframe = 0;
126+
// cropbox.X = 0;
127+
}
128+
129+
130+
}
131+
132+
public void hitCheck()
133+
{
134+
if (hitbox.Intersects(player.hitbox))
135+
{
136+
tophitbox.X = hitbox.X+5;
137+
tophitbox.Y = hitbox.Y;
138+
playerfeet = new Rectangle(player.hitbox.X+10, player.hitbox.Y + player.hitbox.Height - 10, player.hitbox.Width - 10, 10); //10
139+
tophitbox.Height = player.yvel;
140+
if (tophitbox.Intersects(playerfeet))
141+
{
142+
hitbox.X +=500;
143+
}
144+
else
145+
{
146+
player.xvel += xvel*4;
147+
}
148+
}
149+
}
150+
151+
public override void draw(SpriteBatch _spriteBatch)
152+
{
153+
drawbox.X = (int)(hitbox.X-10) - player.centerWorldX + player.centerX;
154+
drawbox.Y = (int)(hitbox.Y-20) - player.centerWorldY + player.centerY;
155+
// _spriteBatch.Draw(battexture, drawbox, cropbox, Color.White);
156+
_spriteBatch.Draw(texture, drawbox, cropbox, Color.White,0,Vector2.Zero, facingeffect,1);
157+
}
158+
}
159+
}

0 commit comments

Comments
 (0)