Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (TedMar, AndrewAMD), 1,344 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
[Newton] Function question #48298
06/25/05 08:29
06/25/05 08:29
Joined: Jan 2003
Posts: 1,142
California
Daedelus Offline OP
Senior Developer
Daedelus  Offline OP
Senior Developer

Joined: Jan 2003
Posts: 1,142
California
My saved levels load fine during the same session but if I close Gamestudio and load the saved game again, Newton doesen't seem to remember that certain entities are physics objects.
Is there a way I can get Newton to write to my saved game file with this function? Can it be done by using NewtonBodySetTransform ? If so, how? Thanks

////////////////////////////////

function load_game()
{
saving_pan.visible = off;
main_panel.visible = off;
pause_panel.visible = off;
freeze_mode = 1;

loading_pan.visible = on;
loading_pan.pos_x = (screen_size.x / 2) - (bmap_Width(loadingmap) / 2);
loading_pan.pos_y = (screen_size.y / 2) - (bmap_Height(loadingmap) / 2);
pause_panel.visible = off;
if(game_load("21save",001)>0)
{
sleep (2);
loading_pan.visible = off;
purge_bmaps();
kill_music();
freeze_mode = 0;
mouse_mode = 0;
set_video_mode(vid_mode);
game_state = 1;
}
else
{
game_state = 0;
main_back();
loading_pan.visible = OFF;
ui_panel.visible = OFF;
}
}

Last edited by Daedelus; 06/25/05 09:00.
Re: [Newton] Function question [Re: Daedelus] #48299
06/25/05 12:15
06/25/05 12:15
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
with NewtonBodySetTransform you can reset the position of a newton entity. usually physics entities get moved by forces. sometimes it's helpful though if you can reset it to any position you want. you can't simply change entity.x/y/z then because the newton engine wouldn't know about that. so you have to use NewtonBodySetTransform.

for integrating newton with the load/save system of the engine i would cycle through the newton entities and save all important properties (velocity, mass,...) before destroying them. after loading you have to create them again and reset the saved properties.

Re: [Newton] Function question [Re: ventilator] #48300
06/25/05 18:36
06/25/05 18:36
Joined: Jan 2003
Posts: 1,142
California
Daedelus Offline OP
Senior Developer
Daedelus  Offline OP
Senior Developer

Joined: Jan 2003
Posts: 1,142
California
Thanks Ventilator, so NewtonBodySetTransform is still necessary even if the positions are remembered during game load?


Formula Games - A place to buy and sell Indie games.

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1