Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » Applications created with U++ » CastleBuilder - simply 2D platform game with editor
Re: CastleBuilder - simply 2D platform game with editor [message #44554 is a reply to message #44408] Fri, 27 March 2015 21:26 Go to previous messageGo to previous message
Klugier is currently offline  Klugier
Messages: 1105
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello Deep,

In layer code there is really no magic. Unless you want to play with transparency (My simply engine doesn't allow that).

Here is part of draw level method:
	for (int layer = level.getLayers() - 1; layer >= 0; layer--) {
		for (int row = 0; row < level.getRows(); row++) {
			for (int col = 0;  col < level.getCols(); col++) {
				int x0 = col * c - view.x;
				int y0 = row * c - view.y;
				
				// Don't paint invisible ellements
				if (x0 + c > 0 && y0 + c > 0 && x0 - c < sz.cx && y0 - c < sz.cy) {
					drawElement(bp, layer, row, col, x0, y0, c, complete || gameOver);
				}
			}
		}

                // ... draw player, draw enemies etc. ...
	}


P.S.
I will consider making this code open source. But, firstly I will need to do some code cleaning's...

Sincerely,
Klugier


U++ - one framework to rule them all.

[Updated on: Fri, 27 March 2015 21:26]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Sauklaue resp. SWord
Next Topic: TheArduIDE - Ide for Arduino development
Goto Forum:
  


Current Time: Sun Aug 03 20:18:05 CEST 2025

Total time taken to generate the page: 0.05684 seconds