Hallo Leute,
wollte mir mal Types ein wenig näherbringen und habe dazu ein kleines Projekt gefunden. Allerdings bekomme ich es nicht zum laufen
um mit den Werten zu spielen und mir die Auswirkung anzusschauen. Kann mir jemand helfen un dsagen wo der Fehler liegt?.
Das Projekt ist das hier: http://www.commodore-welt.de/tutorial/tutorial.pdf .
Dank im voraus.
Here's an example that I've just put together.
I've commented in the code what each part does. Hopefully by changing values you can understand a bit more.
great ian , this will help a lot of user
Thanks very much Ian. That is what i need.
Schön in einen Tutorial genannt/zitiert zu werden :)
Apropros Tut, läufts ?
Ne aktuell andere Sachen um die Ohren.
Wenn du aber ein Problem hast, helfe ich natürlich gerne.
Schade das mit dem TUT, aber von deiner Hilfe werde ich gerne bei Zeiten Gebrauch machen.
Tried your shooter Ian!
Quite raiden!
I´m keeping it, I have been afraid of functions and types for quite a while.
Your example game is montruously clear to get to the point of how to use both.
Thanks!
Cheers.
It's just a simple thing, but can hopefully lead to a better understanding and a cleaner method of working. Functions are just small portions of code that can do something, then hand back control to the main loop.
You could easily enhance that "game" by having the rocks move down the screen (at different speeds etc.) For that you could add a "speed" variable to the rock TYPE so that each rock moves at a constant but different speed, creating a type of parallax.
Eg
TYPE Trock
x
y
speed
ENDTYPE
Then adding -
FUNCTION create_rock:
...
...
r.speed=RND(3)+1
...
DIMPUSH ro[],r
ENDFUNCTION
and adding the y co-ordinate of each rock
FUNCTION render_rock:
...
...
INC r.y, r.speed
// Respawn rock if it goes off the bottom of the screen
IF r.y>480
create_rock()
DELETE r
ENDIF
...
...
ENDFUNCTION
You could build on those ideas to mkae the rocks bigger or smaller (add a "size" variable to the TYPE), add aliens, power-ups etc. Using the bullet/rock collision code you could make rocks collide with the ship etc. etc.
It's a small start that can lead to bigger and more exciting games.
Very cool.