|
2 registered members (Grant, AndrewAMD),
911
guests, and 9
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Old snake game effect
[Re: 3run]
#318541
04/08/10 10:46
04/08/10 10:46
|
Joined: Jun 2006
Posts: 379 Flevoland, 5 meters under wate...
Roel
Senior Member
|
Senior Member
Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
|
you can do this with something like the following: if(my.x > 2000) -> out of screen right if(my.x < -2000) -> out of screen left if(my.y > 2000) -> out of screen up if(my.y < -2000) -> out of screen down when one of the if instructions is true, the player is out of the screen. I assume here that the borders of the screen are all at 2000 quants(you can replace them with your own variables with vec_for_screen you can look up what the screen borders are. this is just a basic idea. the coding you will have to do for yourself! 
|
|
|
Re: Old snake game effect
[Re: 3run]
#318580
04/08/10 15:37
04/08/10 15:37
|
Joined: Dec 2008
Posts: 605 47°19'02.40" N 8°32'54.67" E...
hopfel
User
|
User
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67" E...
|
You can make a second snake and create it at the right position on the other site of the screen and delete the first one after it's totally out of the screen. Just give the second snake the same function from the first one.
Hope, I could help ^^
Hilf mir, dir zu helfen!
|
|
|
Re: Old snake game effect
[Re: 3run]
#318753
04/09/10 15:59
04/09/10 15:59
|
Joined: Dec 2008
Posts: 605 47°19'02.40" N 8°32'54.67" E...
hopfel
User
|
User
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67" E...
|
I think, there is no other (or just more complicated) way, as creating a new snake. But it's a good solution, you just have to realize it right. (may be you must roll up your code a bit)
1. The snake must have his own function. 2. The size etc. of the snake must be saved in global variables. 3. At the start from the snake-function you must adapt it at this variables. 4. Stopp the while loop in the snake-function after the snake is out of the screen. Create a new snake with the same function. Make the old one continue crawling until it's totally over the screen, then remove the old snakemodel.
It seems easy for me. Hope it helps, Hopfel
Hilf mir, dir zu helfen!
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|