I want to make a tower defense game but with a twist, the waypoints are generated instead of predefined
This isn't really something new, so if you know the logic behind it, please do share.
It's pretty simple if I'm understanding right. You use code to have the waypoints generate enemies, but to generate the waypoints, you have to use a sort of Create Object function and for the X and Y coordinates of it, use random values.
For example, if you had a room that was 1280x720, you could put something like this for the X and Y coordinates:
X: 200 + random(880)
Y: 200 + random(320)
This creates randomly placed waypoints, but with a 200 pixel border around each part of the room.
Create a separate object of the same size as the waypoint, and make that object invisible.
Upon creation of this new object:
X: 200 + random(880) for the new object
Y: 200 + random(320) for the new object
Check for a collision against tower:
If new object is in collision with tower,
X: 200 + random(880) for the new object
Y: 200 + random(320) for the new object
else:
Create object waypoint (newobject.x, newobject.y)
Delete the instance of the new object