Create table and Insert into drafts

Working on my tables and insert into commands today.

CREATE TABLE tblPlayer(
PlayerID INTEGER PRIMARY KEY,
FOREIGN KEY(PlayerStatusID) REFERENCES tblPlayerStatus(PlayerStatusID),
FOREIGN KEY(AccID) REFERENCES tblAccountDetails(AccID)
hp INTEGER (3),
end INTEGER (3),
mp INTEGER (3),
agi INTEGER (3),
int INTEGER (3),
str INTEGER (3),
lvl INTEGER (3),
alive ENUM (‘Yes’, “No”)
);

CREATE TABLE tblAccountDetails(
AccID INTEGER PRIMARY KEY,
FOREIGN KEY (PlayerID) REFERENCES tblPlayer (PlayerID),
PlayerName VARCHAR(32) NOT NULL,
PlayerPassword VARCHAR(32) NOT NULL)
);

CREATE TABLE tblPlayerCoord
FOREIGN KEY (PlayerID) REFERENCES tblPlayer (PlayerID),
PCoordX INTEGER (2) NOT NULL,
PCoordY INTEGER (2) NOT NULL)
);

CREATE TABLE tblMobCoord
FOREIGN KEY (MobID) REFERENCES tblMob (MobID),
MCoordX INTEGER (2) NOT NULL,
MCoordY INTEGER (2) NOT NULL)
);

CREATE TABLE tblMob(
MobID INTEGER PRIMARY KEY,
hp INTEGER (3),
end INTEGER (3),
mp INTEGER (3),
agi INTEGER (3),
int INTEGER (3),
str INTEGER (3),
lvl INTEGER (3),
alive ENUM (‘Yes’, “No”)
);

Kinda dislike that mysql doesnt have a BOOLEAN y/n command.

Enum is more versitile, but boolean is nice and simple.

INSERT INTO tblPlayerCoord(PCoordX,PCoordY)
VALUES (20,10);

INSERT INTO tblPlayerID(PlayerID, hp, end, mp, agi, int, str, lvl, alive)
VALUES (1, 20, 5, 50, 6, 10, 2, 13, ‘Yes’);

These just continue on for the other tables in the same formats.

Thinking about how it will draw and move the spirtes onscreen, coords will need to be labled as player and mob coords  [ex MCoordY MCoord PCoordY PCoordX] so the program knows where they are on the grid.

Leave a comment