Mintoris
Aug 20, 2018, 02:33 AM *
Welcome, Guest.

login

register

Did you miss your activation email?


Login with username, password and session length
News:
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Focusing a specific sprite  (Read 80 times)
Novoitch
Jr. Member
**
Posts: 6


« on: Jul 28, 2018, 02:28 AM »

Is there a way to center the view on a specific tile?
Or do we need to recalculate position of all other sprites exept the focused one?
Logged
Mintoris
Administrator
Full Member
*****
Posts: 42



« Reply #1 on: Jul 28, 2018, 08:36 AM »

We need a little more info on what you are doing.
Logged
Novoitch
Jr. Member
**
Posts: 6


« Reply #2 on: Jul 28, 2018, 02:01 PM »

It's just to know if it's possible to do some optimization by avoiding useless operations.

I will take the example of the mintoris game "Space" :
In this game, the player is always drawn at the same coordinates, the view is centered on this sprite.
When moving, it's in fact the entire scene that move, but not the player.

So my question is : "Is the player effectively have always the same x and y, and so this is the positions of other sprites that are updated each tick. Or is there a way (a command i missed, for example,...) to move an entire scene/layer exepted (or not) a specific sprite"

I already looked for a command like this in the reference, but didn't find anything.
Logged
Mintoris
Administrator
Full Member
*****
Posts: 42



« Reply #3 on: Jul 28, 2018, 05:24 PM »

Hmm, had to dig into the code for this answer. There are features of the game engine that have not been implemented in Basic yet. When I get back around to the game engine, everything is going to change into something much easier. I've had a couple years to think of ways to simplify things. Anyway, one of the unimplemented features is a gravity well setting on a sprite. You can have up to 4 gravity wells in a scene at once. You have to tell all the objects affected by gravity which sprite is the gravity well. After that those sprites will fall towards the gravity well. I think that you can change the gravitational strength of the "gravity well sprite" by setting it's mass. I will be adding this feature after the version 8 upgrade is complete. There is also a formula for putting a sprite in orbit around a gravity well.

In the mean time you might consider adding sprite modifier subs to each sprite so they fall towards a single sprite. This is a fairly efficient way to modify the movement of groups of sprites. It would basically do the same thing as the gravity well feature.
« Last Edit: Jul 28, 2018, 05:34 PM by Mintoris » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.024 seconds with 17 queries.