Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Move View depend on Move Player

Author
Message
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 8th Apr 2015 12:00
Hi.

I want make a platform game and wrote a code for move view depend on move player, but It don't work good.

this is my code:



Please Guide Me to wrote a Platform view.

Thanks.
Funnell7
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 8th Apr 2015 12:38 Edited at: 8th Apr 2015 12:44
What exactly do you mean by 'but It don't work good'?

Firstly, if you want the player to move around in world coordinates, you do not want to fix him to the screen...

Secondly, I assume you want the player to remain centered? If so, you want to set the view offset at the character position -half the screen size...

For example, you'd do something like this;

SetViewOffset(GetSpriteXByOffset(Player) - (GetVirtualWidth() / 2),GetViewOffsetY())

This will keep the player in the center, and assumes you are using Virtual Resolution...

Using AppGameKit V2 Tier 1
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 8th Apr 2015 13:45
Quote: "What exactly do you mean by 'but It don't work good'? "


if press right key, player don't move to right after come to center.

Quote: "This will keep the player in the center, and assumes you are using Virtual Resolution..."


I use Percentage system and used:

Funnell7
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 8th Apr 2015 13:54 Edited at: 8th Apr 2015 13:54
Did you remove;

FixSpriteToScreen(Player,1)

Post your new code...

Using AppGameKit V2 Tier 1
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 8th Apr 2015 14:00
Quote: "Did you remove;

FixSpriteToScreen(Player,1)"


yes, i removed it.

IronManhood
9
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
Posted: 8th Apr 2015 14:23
This:


Should be this:
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 8th Apr 2015 14:41
I mistake Funnell7, fixed it.

Thanks Funnell7 for help.

Thanks IronManhood

Login to post a reply

Server time is: 2024-04-23 07:19:19
Your offset time is: 2024-04-23 07:19:19