-
Notifications
You must be signed in to change notification settings - Fork 0
/
objects.hpp
123 lines (83 loc) · 2.4 KB
/
objects.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//
// objects.hpp
// Hopscotch
//
// Created by John Ziegler on 10/29/24.
// Copyright © 2024 John Ziegler. All rights reserved.
//
#ifndef objects_hpp
#define objects_hpp
#include "vsprite.hpp"
class State;
struct Stump: public ZSprite {
FloatRect hitBox () override;
};
struct Oxyd: public ZSprite {
void initTxs (Texture& oxtx, Texture& covtx, Texture& symtx);
void initPos (vecF& p);
void reset ();
void draw (RenderTarget& target, RenderStates states) const;
void makeOpen (bool op);
void update ();
void animateSymbol ();
void checkOpenCover ();
void checkCloseCover ();
Sprite symbol,
cover;
Texture* myPicture;
float symbolScaleDegree = 0;
static constexpr int openingFrames = 80;
int openingFrmCt = 0;
int closingFrmCt = 0;
bool matched = false;
bool isOpen = false;
};
struct Deh: public VSprite {
Deh () { }
void reset ();
void win ();
void land ();
void changeTex (string tx);
void update (const Time& t = Time::Zero) ;
unordered_map<string, int> texMap {
{"faceLeft", 8},
{"faceRight", 9},
{"still", 14},
{"walkLeft", 15},
{"walkRight", 16}
};
State* gam = nullptr;
Keyboard::Key jumpKey = Keyboard::Key::Space;
string curTex;
float maxSpeed = 7;
float frictionClamp = .001;
float xfriction = .82;
float accel = .6;
float jumpSpeed = 13;
float maxFallSpeed = 18;
float grav = .6;
float fallAccel = 1.18;
float walkFrameInterval = .1;
bool canJump = true;
bool landedSinceJump = true;
bool landedThisFrame = false;
bool isOnGround = false;
bool wasOnGround = false;
bool jumpKeyOff = true;
bool won = false;
bool cartwheelFinished = false;
bool isDead = false;
}; // end Deh
struct Level {
Level () { }
Level (uint id, uint num, string f, vecF ds = vecF(ScrCX, ScrCY)) :
levelID(id),
numMatches(num),
fname(f),
dehStart(ds) { }
string fname;
vecF dehStart;
uint numMatches;
uint levelID = 0;
};
#endif /* objects_hpp */