Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Image overlays in Turing
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Luganchan




PostPosted: Thu Jan 09, 2014 1:14 pm   Post subject: Image overlays in Turing

What is it you are trying to achieve?
I'm trying to layer one image onto another in Turing.


What is the problem you are having?
I don't know how to have a background image and another image moving overtop, without erasing the background

Long version
My idea here was to make a cave explorer game in Turing in a similar style to caves in Pokemon (prior to gen 4) Where you only have a limited sight of your surroundings. I need to have a black overlay to move around with my character and block out some vision, but i have no idea how to do this without erasing the background.
Sponsor
Sponsor
Sponsor
sponsor
Raknarg




PostPosted: Thu Jan 09, 2014 1:28 pm   Post subject: RE:Image overlays in Turing

Consider this:

Turing:

setscreen ("offscreenonly")

procedure background
    Draw.FillBox (30, 30, maxx - 30, maxy - 30, 12)
end background

loop
    for i : 0 .. maxx
        background
        Draw.FillOval(i, maxy div 2, 20, 20, brightblue)
        View.Update
        delay(2)
        cls
    end for
end loop


All you do is redraw the background every frame (so once per loop).
evildaddy911




PostPosted: Thu Jan 09, 2014 3:50 pm   Post subject: RE:Image overlays in Turing

take a look at Pic.Draw, specifically the last parameter, mode:int
Raknarg




PostPosted: Thu Jan 09, 2014 4:01 pm   Post subject: RE:Image overlays in Turing

Hold on, allow me to reword your question, OP. Are you asking how to make it so you can only see a circle cut out of the background, and the rest shrouded in black? As if you have a lantern shining from the character that only goes so far?
Dreadnought




PostPosted: Thu Jan 09, 2014 9:12 pm   Post subject: Re: Image overlays in Turing

I agree with Raknarg, it sounds like what you want is to put an image (black screen with a circle cut out) overtop of your game. (I guess you would call this a mask) instead of drawing your game over a background.

evildaddy911 is right, you can use the mode parameter of Pic.Draw to make a colour (white by default) transparent when you draw a picture. This would allow you to make a mask and just draw it on top of everything with the correct mode.

There is an even easier way of doing this. So easy in fact I feel like it's almost cheating, so I'll just tell you to look in the View module.
evildaddy911




PostPosted: Thu Jan 09, 2014 9:55 pm   Post subject: RE:Image overlays in Turing

wow.. i guess you learn something new every day eh?
Luganchan




PostPosted: Fri Jan 10, 2014 12:14 pm   Post subject: Re: RE:Image overlays in Turing

Raknarg @ Thu Jan 09, 2014 4:01 pm wrote:
Hold on, allow me to reword your question, OP. Are you asking how to make it so you can only see a circle cut out of the background, and the rest shrouded in black? As if you have a lantern shining from the character that only goes so far?


Exactly that, im trying to apply a mask, but if i redraw the background every frame, it gets very flickery if it refreshes every frame with lareg images, i'll try the Pic.Draw parameter, and report what happens, you guys are a savior for a procrastinating gr.11 student.
Insectoid




PostPosted: Fri Jan 10, 2014 12:40 pm   Post subject: RE:Image overlays in Turing

Quote:
it gets very flickery if it refreshes every frame


This is actually really easy to fix. You'll find a solution in the FAQ sticky in Turing Help.
Sponsor
Sponsor
Sponsor
sponsor
Luganchan




PostPosted: Fri Jan 10, 2014 12:46 pm   Post subject: RE:Image overlays in Turing

I am currently using the View.Update, and View.Set, the animation of the backgroud is smooth, but my actual character now has very delayed movements, and bugs with the background more than ever, i'm sure that i can solve the collision issue, but the movements have become very static and move a few extra pixels after i set go of the command keys.
Insectoid




PostPosted: Fri Jan 10, 2014 1:22 pm   Post subject: RE:Image overlays in Turing

Well then, your View.Update is probably in the wrong spot, or your animation is poorly structured.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 10 Posts ]
Jump to:   


Style:  
Search: